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
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
Exception