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/web_socket_channel.dart';
import 'package:web_socket_channel/status.dart' as status;

void main() async {
  var channel = WebSocketChannel.connect(Uri.parse('ws://localhost:1234'));
  // ...
  channel.close(status.goingAway);
}

Constants

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