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

Side by Side Diff: lib/src/web_socket/channel.dart

Issue 1763583003: Deprecate WebSocketChannel. (Closed) Base URL: git@github.com:dart-lang/http_parser@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 | « lib/src/web_socket.dart ('k') | lib/src/web_socket/compatible.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 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 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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:async/async.dart'; 7 import 'package:async/async.dart';
8 import 'package:crypto/crypto.dart'; 8 import 'package:crypto/crypto.dart';
9 import 'package:stream_channel/stream_channel.dart'; 9 import 'package:stream_channel/stream_channel.dart';
10 10
11 import '../copy/web_socket_impl.dart'; 11 import '../copy/web_socket_impl.dart';
12 12
13 /// A [StreamChannel] implementation of the WebSocket protocol. 13 /// This class is deprecated.
14 /// 14 ///
15 /// This is not specific to `dart:io` or to any particular HTTP API. Because of 15 /// Use the [`web_socket_channel`][web_socket_channel] package instead.
16 /// that, it doesn't handle the initial [WebSocket handshake][]. This needs to
17 /// be handled manually by the user of the code. Once that's been done, [new
18 /// WebSocketChannel] can be called with the underlying socket and it will
19 /// handle the remainder of the protocol.
20 /// 16 ///
21 /// [WebSocket handshake]: https://tools.ietf.org/html/rfc6455#section-4 17 /// [web_socket_channel]: https://pub.dartlang.org/packages/web_socket_channel
18 @Deprecated("Will be removed in 3.0.0.")
22 class WebSocketChannel extends StreamChannelMixin { 19 class WebSocketChannel extends StreamChannelMixin {
23 /// The underlying web socket. 20 /// The underlying web socket.
24 /// 21 ///
25 /// This is essentially a copy of `dart:io`'s WebSocket implementation, with 22 /// This is essentially a copy of `dart:io`'s WebSocket implementation, with
26 /// the IO-specific pieces factored out. 23 /// the IO-specific pieces factored out.
27 final WebSocketImpl _webSocket; 24 final WebSocketImpl _webSocket;
28 25
29 /// The interval for sending ping signals. 26 /// The interval for sending ping signals.
30 /// 27 ///
31 /// If a ping message is not answered by a pong message from the peer, the 28 /// If a ping message is not answered by a pong message from the peer, the
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 /// If this is a WebSocket server, [serverSide] should be `true` (the 89 /// If this is a WebSocket server, [serverSide] should be `true` (the
93 /// default); if it's a client, [serverSide] should be `false`. 90 /// default); if it's a client, [serverSide] should be `false`.
94 /// 91 ///
95 /// [WebSocket handshake]: https://tools.ietf.org/html/rfc6455#section-4 92 /// [WebSocket handshake]: https://tools.ietf.org/html/rfc6455#section-4
96 WebSocketChannel(StreamChannel<List<int>> channel, 93 WebSocketChannel(StreamChannel<List<int>> channel,
97 {String protocol, bool serverSide: true}) 94 {String protocol, bool serverSide: true})
98 : _webSocket = new WebSocketImpl.fromSocket( 95 : _webSocket = new WebSocketImpl.fromSocket(
99 channel.stream, channel.sink, protocol, serverSide); 96 channel.stream, channel.sink, protocol, serverSide);
100 } 97 }
101 98
102 /// The sink exposed by a [CompatibleWebSocket]. 99 /// This class is deprecated.
103 /// 100 ///
104 /// This is like a normal [StreamSink], except that it supports extra arguments 101 /// Use the [`web_socket_channel`][web_socket_channel] package instead.
105 /// to [close]. 102 ///
103 /// [web_socket_channel]: https://pub.dartlang.org/packages/web_socket_channel
104 @Deprecated("Will be removed in 3.0.0.")
106 class WebSocketSink extends DelegatingStreamSink { 105 class WebSocketSink extends DelegatingStreamSink {
107 final WebSocketImpl _webSocket; 106 final WebSocketImpl _webSocket;
108 107
109 WebSocketSink._(WebSocketImpl webSocket) 108 WebSocketSink._(WebSocketImpl webSocket)
110 : super(webSocket), 109 : super(webSocket),
111 _webSocket = webSocket; 110 _webSocket = webSocket;
112 111
113 /// Closes the web socket connection. 112 /// Closes the web socket connection.
114 /// 113 ///
115 /// [closeCode] and [closeReason] are the [close code][] and [reason][] sent 114 /// [closeCode] and [closeReason] are the [close code][] and [reason][] sent
116 /// to the remote peer, respectively. If they are omitted, the peer will see 115 /// to the remote peer, respectively. If they are omitted, the peer will see
117 /// a "no status received" code with no reason. 116 /// a "no status received" code with no reason.
118 /// 117 ///
119 /// [close code]: https://tools.ietf.org/html/rfc6455#section-7.1.5 118 /// [close code]: https://tools.ietf.org/html/rfc6455#section-7.1.5
120 /// [reason]: https://tools.ietf.org/html/rfc6455#section-7.1.6 119 /// [reason]: https://tools.ietf.org/html/rfc6455#section-7.1.6
121 Future close([int closeCode, String closeReason]) => 120 Future close([int closeCode, String closeReason]) =>
122 _webSocket.close(closeCode, closeReason); 121 _webSocket.close(closeCode, closeReason);
123 } 122 }
OLDNEW
« no previous file with comments | « lib/src/web_socket.dart ('k') | lib/src/web_socket/compatible.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698