Comments (3)
i was facing the same issue no one helped so what i did was i just created listner for every 3 second if my hub is disconnected then do reconnect sample code:
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:signalr_core/signalr_core.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@OverRide
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('HubConnection Status Checker'),
),
body: Center(
child: HubConnectionStatusChecker(),
),
),
);
}
}
class HubConnectionStatusChecker extends StatefulWidget {
@OverRide
_HubConnectionStatusCheckerState createState() => _HubConnectionStatusCheckerState();
}
class _HubConnectionStatusCheckerState extends State {
late HubConnection _hubConnection;
late Timer _timer;
@OverRide
void initState() {
super.initState();
// Initialize your HubConnection here
_hubConnection = HubConnectionBuilder()
.withUrl('your_hub_connection_url')
.build();
// Start checking the connection status every second
_timer = Timer.periodic(Duration(seconds: 1), (timer) {
// Check the connection status
if (_hubConnection.state == HubConnectionState.Connected) {
print('HubConnection is connected');
} else {
print('HubConnection is not connected');
// Optionally, try to start the connection again
// _hubConnection.start();
}
});
}
@OverRide
void dispose() {
// Cancel the timer and dispose the HubConnection
_timer.cancel();
_hubConnection.stop();
super.dispose();
}
@OverRide
Widget build(BuildContext context) {
return Text('Checking HubConnection status...');
}
}
and it worked perfectly now i am not facing this issue
from signalr_client.
facing the same issue in android devices
from signalr_client.
facing the same issue in android and iOS devices
from signalr_client.
Related Issues (20)
- Does reconnect feature works when backend restarts ?
- Error when setting transport to HttpTransportType.LongPolling
- compatibility with http ^1.1.0 HOT 1
- No client method with the name 'xxx' found HOT 1
- invoke upload progress feature
- SignalR error on mobile web. Uncaught error on mobile
- Connection closed while receiving data
- Do you have any update plans? HOT 1
- MessageHeaders question HOT 2
- Hub connection get close when the screen gets timeout HOT 1
- final List<Stream<Object>> streams = [] error valid range
- Various error messages, no proposed solution works HOT 1
- Connection not upgraded to web socket HOT 3
- was not upgraded to websocket version 1.5.7 HOT 1
- Not working with WebSockets: The underlying connection was closed before the hub handshake could complete. HOT 2
- Bad state: Future already completed
- Method Not Allowed
- Upgrade sse_channel library to version 0.1.1 HOT 1
- Deploy to pub.dev HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from signalr_client.