Status codes that are defined in the WebSocket spec.

This library is intended to be imported with a prefix.

import 'package:web_socket_channel/io.dart';
import 'package:web_socket_channel/status.dart' as status;

main() async {
  var channel = await IOWebSocketChannel.connect("ws://localhost:1234");
  // ...
  channel.close(status.goingAway);
}

Constants

abnormalClosure → dynamic
The connection was closed abnormally. [...]
1006
goingAway → dynamic
An endpoint is "going away", such as a server going down or a browser having navigated away from a page.
1001
internalServerError → dynamic
The server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.
1011
invalidFramePayloadData → dynamic
An endpoint is terminating the connection because it has received data within a message that was not consistent with the type of the message. [...]
1007
messageTooBig → dynamic
An endpoint is terminating the connection because it has received a message that is too big for it to process.
1009
missingMandatoryExtension → dynamic
The client is terminating the connection because it expected the server to negotiate one or more extensions, but the server didn't return them in the response message of the WebSocket handshake. [...]
1010
normalClosure → dynamic
The purpose for which the connection was established has been fulfilled.
1000
noStatusReceived → dynamic
No status code was present. [...]
1005
policyViolation → dynamic
An endpoint is terminating the connection because it has received a message that violates its policy. [...]
1008
protocolError → dynamic
An endpoint is terminating the connection due to a protocol error.
1002
tlsHandshakeFailed → dynamic
The connection was closed due to a failure to perform a TLS handshake. [...]
1015
unsupportedData → dynamic
An endpoint is terminating the connection because it has received a type of data it cannot accept. [...]
1003