Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebSocketChannel close code throws exception #372

Open
dukefirehawk opened this issue Jun 3, 2024 · 1 comment
Open

WebSocketChannel close code throws exception #372

dukefirehawk opened this issue Jun 3, 2024 · 1 comment

Comments

@dukefirehawk
Copy link

For version 3.0.0, when calling close with a status argument, it throws an exception. Only status.normalClosure which is 1000 works. The rest of the status code seems like not being mapped into the 3000-4999 range which can cause the exception to be thrown.

Code snippet

    var channel = IOWebSocketChannel.connect(...);
    ...
    channel.sink.close(status.goingAway);
    

Exception

  Invalid argument(s): Invalid argument: 1001, close code must be 1000 or in the range 3000-4999
  package:web_socket/src/utils.dart 10:5                             checkCloseCode
  package:web_socket/src/io_web_socket.dart 108:5                    IOWebSocket.close
  package:web_socket_channel/adapter_web_socket_channel.dart 112:27  new AdapterWebSocketChannel.<fn>.<fn>
  package:stream_channel                                             _GuaranteeSink.close
  package:async/src/delegate/stream_sink.dart 47:27                  DelegatingStreamSink.close
  package:web_socket_channel/adapter_web_socket_channel.dart 147:18  _WebSocketSink.close
@KevlarTheGreat
Copy link

Same problem on version 3.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants