Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: lib/status.dart

Issue 1758053002: Add a top-level status library. (Closed) Base URL: git@github.com:dart-lang/web_socket_channel.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « README.md ('k') | pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 /// Status codes that are defined in the WebSocket spec.
6 ///
7 /// This library is intended to be imported with a prefix.
8 ///
9 /// ```dart
10 /// import 'package:web_socket_channel/io.dart';
11 /// import 'package:web_socket_channel/status.dart' as status;
12 ///
13 /// main() async {
14 /// var channel = await IOWebSocketChannel.connect("ws://localhost:1234");
15 /// // ...
16 /// channel.close(status.goingAway);
17 /// }
18 /// ```
19 import 'dart:core';
20
21 /// The purpose for which the connection was established has been fulfilled.
22 const normalClosure = 1000;
23
24 /// An endpoint is "going away", such as a server going down or a browser having
25 /// navigated away from a page.
26 const goingAway = 1001;
27
28 /// An endpoint is terminating the connection due to a protocol error.
29 const protocolError = 1002;
30
31 /// An endpoint is terminating the connection because it has received a type of
32 /// data it cannot accept.
33 ///
34 /// For example, an endpoint that understands only text data MAY send this if it
35 /// receives a binary message).
36 const unsupportedData = 1003;
37
38 /// No status code was present.
39 ///
40 /// This **must not** be set explicitly by an endpoint.
41 const noStatusReceived = 1005;
42
43 /// The connection was closed abnormally.
44 ///
45 /// For example, this is used if the connection was closed without sending or
46 /// receiving a Close control frame.
47 ///
48 /// This **must not** be set explicitly by an endpoint.
49 const abnormalClosure = 1006;
50
51 /// An endpoint is terminating the connection because it has received data
52 /// within a message that was not consistent with the type of the message.
53 ///
54 /// For example, the endpoint may have receieved non-UTF-8 data within a text
55 /// message.
56 const invalidFramePayloadData = 1007;
57
58 /// An endpoint is terminating the connection because it has received a message
59 /// that violates its policy.
60 ///
61 /// This is a generic status code that can be returned when there is no other
62 /// more suitable status code (such as [unsupportedData] or [messageTooBig]), or
63 /// if there is a need to hide specific details about the policy.
64 const policyViolation = 1008;
65
66 /// An endpoint is terminating the connection because it has received a message
67 /// that is too big for it to process.
68 const messageTooBig = 1009;
69
70 /// The client is terminating the connection because it expected the server to
71 /// negotiate one or more extensions, but the server didn't return them in the
72 /// response message of the WebSocket handshake.
73 ///
74 /// The list of extensions that are needed should appear in the close reason.
75 /// Note that this status code is not used by the server, because it can fail
76 /// the WebSocket handshake instead.
77 const missingMandatoryExtension = 1010;
78
79 /// The server is terminating the connection because it encountered an
80 /// unexpected condition that prevented it from fulfilling the request.
81 const internalServerError = 1011;
82
83 /// The connection was closed due to a failure to perform a TLS handshake.
84 ///
85 /// For example, the server certificate may not have been verified.
86 ///
87 /// This **must not** be set explicitly by an endpoint.
88 const tlsHandshakeFailed = 1015;
OLDNEW
« no previous file with comments | « README.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698