Code Monkey home page Code Monkey logo

Comments (18)

abhinavsingh avatar abhinavsingh commented on July 18, 2024 12

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.

1AlexFix1 avatar 1AlexFix1 commented on July 18, 2024 1

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.

nex3 avatar nex3 commented on July 18, 2024 1

I'm no longer on the Dart team, so I'm not involved in the maintenance of this package anymore.

from web_socket_channel.

nailgilaziev avatar nailgilaziev commented on July 18, 2024

@nex3 hi!
please tell us, any updates on a this problem?

from web_socket_channel.

nailgilaziev avatar nailgilaziev commented on July 18, 2024

@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.

nex3 avatar nex3 commented on July 18, 2024

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.

artur-ios-dev avatar artur-ios-dev commented on July 18, 2024

@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.

wanjm avatar wanjm commented on July 18, 2024

hello , is there any one working on this ?

from web_socket_channel.

nathanogunleye avatar nathanogunleye commented on July 18, 2024

Any working solution on this? I can't detect the connection state from IOWebSocketChannel object.

from web_socket_channel.

jasonminsookim avatar jasonminsookim commented on July 18, 2024

This would be a useful feature for users who are somewhat new to Websockets.

from web_socket_channel.

guid-empty avatar guid-empty commented on July 18, 2024

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.

vogtb avatar vogtb commented on July 18, 2024

I'm encountering this issue as well. Not a lot of good options to get around this.

from web_socket_channel.

dadagov125 avatar dadagov125 commented on July 18, 2024

Is it really that hard to add a connection state stream?

from web_socket_channel.

AlexV525 avatar AlexV525 commented on July 18, 2024

cc @kevmoo Kevin can you help us to triage this?

from web_socket_channel.

kevmoo avatar kevmoo commented on July 18, 2024

@brianquinlan @devoncarew – thoughts?

from web_socket_channel.

tmtong avatar tmtong commented on July 18, 2024

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.

brianquinlan avatar brianquinlan commented on July 18, 2024

I plan on reviewing #240

Could anyone who has an opinion about this feature please take a look?

from web_socket_channel.

Bungeefan avatar Bungeefan commented on July 18, 2024

For others who have subscribed to this issue:
It seems like this was "silently" implemented by #240.

from web_socket_channel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.