OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart.io; | 5 part of dart.io; |
6 | 6 |
7 /** | 7 /** |
8 * Web socket status codes used when closing a web socket connection. | 8 * Web socket status codes used when closing a web socket connection. |
9 */ | 9 */ |
10 abstract class WebSocketStatus { | 10 abstract class WebSocketStatus { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 /** | 127 /** |
128 * Create a new web socket connection. The URL supplied in [url] | 128 * Create a new web socket connection. The URL supplied in [url] |
129 * must use the scheme [:ws:] or [:wss:]. The [protocols] argument is | 129 * must use the scheme [:ws:] or [:wss:]. The [protocols] argument is |
130 * specifying the subprotocols the client is willing to speak. | 130 * specifying the subprotocols the client is willing to speak. |
131 */ | 131 */ |
132 static Future<WebSocket> connect(String url, | 132 static Future<WebSocket> connect(String url, |
133 {List<String> protocols: const []}) => | 133 {List<String> protocols: const []}) => |
134 _WebSocketImpl.connect(url, protocols); | 134 _WebSocketImpl.connect(url, protocols); |
135 | 135 |
| 136 @Deprecated('This constructor will be removed in Dart 2.0. Use `implements`' |
| 137 ' instead of `extends` if implementing this abstract class.') |
| 138 WebSocket(); |
| 139 |
136 /** | 140 /** |
137 * Creates a WebSocket from an already-upgraded socket. | 141 * Creates a WebSocket from an already-upgraded socket. |
138 * | 142 * |
139 * The initial WebSocket handshake must have occurred prior to this call. A | 143 * The initial WebSocket handshake must have occurred prior to this call. A |
140 * WebSocket client can automatically perform the handshake using | 144 * WebSocket client can automatically perform the handshake using |
141 * [WebSocket.connect], while a server can do so using | 145 * [WebSocket.connect], while a server can do so using |
142 * [WebSocketTransformer.upgrade]. To manually upgrade an [HttpRequest], | 146 * [WebSocketTransformer.upgrade]. To manually upgrade an [HttpRequest], |
143 * [HttpRequest.detachSocket] may be called. | 147 * [HttpRequest.detachSocket] may be called. |
144 * | 148 * |
145 * [protocol] should be the protocol negotiated by this handshake, if any. | 149 * [protocol] should be the protocol negotiated by this handshake, if any. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 */ | 214 */ |
211 Future addStream(Stream stream); | 215 Future addStream(Stream stream); |
212 } | 216 } |
213 | 217 |
214 | 218 |
215 class WebSocketException implements IOException { | 219 class WebSocketException implements IOException { |
216 final String message; | 220 final String message; |
217 const WebSocketException([this.message = ""]); | 221 const WebSocketException([this.message = ""]); |
218 String toString() => "WebSocketException: $message"; | 222 String toString() => "WebSocketException: $message"; |
219 } | 223 } |
OLD | NEW |