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

Side by Side Diff: sdk/lib/io/websocket.dart

Issue 19970004: Add ability to send a ping interval on a WebSocket. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add pingInterval test for server-side and add close-check when sending Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/io/websocket_impl.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) 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 */ 124 */
125 int get closeCode; 125 int get closeCode;
126 126
127 /** 127 /**
128 * The close reason set when the web socket connection is closed. If 128 * The close reason set when the web socket connection is closed. If
129 * there is no close reason available this property will be [:null:] 129 * there is no close reason available this property will be [:null:]
130 */ 130 */
131 String get closeReason; 131 String get closeReason;
132 132
133 /** 133 /**
134 * Set and get the interval for sending ping signals. If a ping message is not
135 * answered by a pong message from the peer, the `WebSocket` is assumed
136 * disconnected and the connection is closed with a
137 * [WebSocketStatus.GOING_AWAY] close code. When a ping signal is sent, the
138 * pong message must be received within [pingInterval].
139 *
140 * There are never two outstanding pings at any given time, and the next ping
141 * timer starts when the pong is received.
142 *
143 * Set the [pingInterval] to `null` to disable sending ping messages.
144 *
145 * The default value is `null`.
146 */
147 Duration pingInterval;
148
149 /**
134 * Closes the web socket connection. Set the optional [code] and [reason] 150 * Closes the web socket connection. Set the optional [code] and [reason]
135 * arguments to send close information to the remote peer. If they are 151 * arguments to send close information to the remote peer. If they are
136 * omitted, the peer will see [WebSocketStatus.NO_STATUS_RECEIVED] code 152 * omitted, the peer will see [WebSocketStatus.NO_STATUS_RECEIVED] code
137 * with no reason. 153 * with no reason.
138 */ 154 */
139 Future close([int code, String reason]); 155 Future close([int code, String reason]);
140 156
141 /** 157 /**
142 * Sends data on the web socket connection. The data in [data] must 158 * Sends data on the web socket connection. The data in [data] must
143 * be either a [:String:], or a [:List<int>:] holding bytes. 159 * be either a [:String:], or a [:List<int>:] holding bytes.
144 */ 160 */
145 void add(data); 161 void add(data);
146 162
147 /** 163 /**
148 * Sends data from a stream on web socket connection. Each data event from 164 * Sends data from a stream on web socket connection. Each data event from
149 * [stream] will be send as a single WebSocket frame. The data from [stream] 165 * [stream] will be send as a single WebSocket frame. The data from [stream]
150 * must be either [:String:]s, or [:List<int>:]s holding bytes. 166 * must be either [:String:]s, or [:List<int>:]s holding bytes.
151 */ 167 */
152 Future addStream(Stream stream); 168 Future addStream(Stream stream);
153 } 169 }
154 170
155 171
156 class WebSocketException implements IOException { 172 class WebSocketException implements IOException {
157 const WebSocketException([String this.message = ""]); 173 const WebSocketException([String this.message = ""]);
158 String toString() => "WebSocketException: $message"; 174 String toString() => "WebSocketException: $message";
159 final String message; 175 final String message;
160 } 176 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/io/websocket_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698