web_socket_channel.status library

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 → const int
The connection was closed abnormally. [...]
1006
goingAway → const int
An endpoint is "going away", such as a server going down or a browser having navigated away from a page.
1001
internalServerError → const int
The server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.
1011
invalidFramePayloadData → const int
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 → const int
An endpoint is terminating the connection because it has received a message that is too big for it to process.
1009
missingMandatoryExtension → const int
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 → const int
The purpose for which the connection was established has been fulfilled.
1000
noStatusReceived → const int
No status code was present. [...]
1005
policyViolation → const int
An endpoint is terminating the connection because it has received a message that violates its policy. [...]
1008
protocolError → const int
An endpoint is terminating the connection due to a protocol error.
1002
tlsHandshakeFailed → const int
The connection was closed due to a failure to perform a TLS handshake. [...]
1015
unsupportedData → const int
An endpoint is terminating the connection because it has received a type of data it cannot accept. [...]
1003