Comments (2)
Thanks, it works!
index_page.dart
void initState(){
super.initState();
listenWs();
}
listenWs(){
widget.channel.stream.listen((onData){
final data = json.decode(onData);
print(data);
},onDone: (){
reConnectWs();
}
);
}
reConnectWs(){
final token = prefs.token;
Future.delayed(Duration(milliseconds: 1000)).then((_){
widget.channel = IOWebSocketChannel.connect(WS_URL);
listenWs();
});
}
routes.dart
IndexPage(channel: IOWebSocketChannel.connect(WS_URL),)
from web_socket_channel.
Anyone help?
from web_socket_channel.
Related Issues (20)
- Websocket connection failed on flutter web HOT 1
- Unable to add dependency 2.4.1 HOT 1
- 2.4.1 seems to have introduced breaking changes HOT 5
- Sequential read issue HOT 1
- Can not listen pusher server HOT 2
- Using signed websocket urls from aws
- 2.4.0 Connection freezing on Windows
- Breaks parse_server_sdk (no idea who's fault it is) HOT 4
- Error: The getter 'EventStreamProviders' isn't defined for the class 'WebSocket'. HOT 3
- Build Failed Because of EventStream error HOT 2
- Flutter build web failing due to EventStreamProviders HOT 6
- WebSocketException: Connection not upgraded to websocket HOT 6
- How to get readyState from WebSocketChannel?
- web_socket_channel ^2.4.2依然没有支持web0.3.0 HOT 1
- Socket connection for self signed certificate
- While I can introduce web_socket_channel into dart, iOS won't be able to call this package
- Web version websocket doesn't work, but ios does HOT 4
- websocket is not connecting
- Add feature HOT 1
- Auto invoke onDown method to close websocket. 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 web_socket_channel.