Comments (18)
Looks like authors of this library never developed a real world application (it works on my system syndrome). Seriously, I am amazed that this issue is now open since mid 2018 and being tossed around the park. Currently upon first connect, there is simply no way to know if/when the connection is ready.
How do you even build a real world app with this?
from web_socket_channel.
Maybe it will help today to know that the socket is connected and close
connection() async {
WebSocket ws = await WebSocket.connect('ws://echo.websocket.org');
print('ws open');
ws.listen(
(data) {
print(data);
},
onDone: () {
ws.close();
print('ws close onDone');
},
onError: (error) {
ws.close();
print('ws close error = $error');
},
);
IOWebSocketChannel iows = IOWebSocketChannel(ws);
iows.sink.add(('Hello, World!'));
}
from web_socket_channel.
I'm no longer on the Dart team, so I'm not involved in the maintenance of this package anymore.
from web_socket_channel.
@nex3 hi!
please tell us, any updates on a this problem?
from web_socket_channel.
@nex3 Can you mention the person who is currently involved in maintenance of this package? Because issue (depending issues) is real and here for a long time. thanks!
from web_socket_channel.
I'm not sure who's maintaining it these days. Judging by the lack of movement on this issue and the pull requests, it may be no one.
from web_socket_channel.
@nex3 @nailgilaziev I have added such field and made a PR. Not sure if it's the cleanest solution (probably not since I am a newbie when it comes to Dart) but maybe someone wants to take a look and improve it there is anything to improve.
from web_socket_channel.
hello , is there any one working on this ?
from web_socket_channel.
Any working solution on this? I can't detect the connection state from IOWebSocketChannel object.
from web_socket_channel.
This would be a useful feature for users who are somewhat new to Websockets.
from web_socket_channel.
If you work with IO my workaround of this issue is to listen to inner websocket state, but it's ugly method and I will rewrite this appoach lated:
_quoteSocketChannel = IOWebSocketChannel.connect(
Uri.parse(SubscriptionEndpoint(token: jwt).path),
);
_quoteSocketChannel.stream.listen(logger.i);
Timer.periodic(Duration(milliseconds: 200), (timer) {
if (_quoteSocketChannel.innerWebSocket?.readyState == WebSocket.open) {
timer.cancel();
_quoteSocketChannel.stream.listen((message) {
print(message);
});
from web_socket_channel.
I'm encountering this issue as well. Not a lot of good options to get around this.
from web_socket_channel.
Is it really that hard to add a connection state stream?
from web_socket_channel.
cc @kevmoo Kevin can you help us to triage this?
from web_socket_channel.
@brianquinlan @devoncarew – thoughts?
from web_socket_channel.
Yo guys
I have a retrytTimer in onError and onDone, otherwise it is set to null
You just need to check if the retryTimer is null. That's all
from web_socket_channel.
I plan on reviewing #240
Could anyone who has an opinion about this feature please take a look?
from web_socket_channel.
For others who have subscribed to this issue:
It seems like this was "silently" implemented by #240.
from web_socket_channel.
Related Issues (20)
- Auto invoke onDown method to close websocket. HOT 1
- Specifying 'protocols' (Sec-WebSocket-Protocol header) causes connection to close.
- HTML: When the WebSocket is in a 'pending' state, calling channel.sink.close does not work. HOT 2
- Masking is not cryptographically secure HOT 1
- I tried to connect with localhost 8081 port but its connect with diffrent port HOT 2
- FormatException: Unexpected character
- Simplify the web_socket_channel implementation HOT 5
- Message received in wrong order
- Support MSGPACK HOT 1
- Any problems with WebSocketChannel.connect under iOS 17.5 beta (or earlier)? HOT 3
- 🐛 RangeError (code): Invalid value: Not in inclusive range 3000..4999: 1000 after updating to 3.0.0 from 2.4.0 HOT 6
- Missing tags for 2.4.5 and 3.0.0
- Conflict package build_runner versions HOT 1
- Documentation for the 3.x migration HOT 11
- Unexpected Behavior and Premature Closure when Using web_socket_channel to Connect to WebSocket Server HOT 2
- WebSocket clients using Apple private relay can't connect to WebSocket server
- WebSocketChannel has unexpected close code
- WebSocketChannel close code throws exception
- There is not way to get acknowledgement of sent messages.
- WebSocket support custom sni host,when use doh 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.