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

Side by Side Diff: lib/html/doc/interface/WebSocket.dartdoc

Issue 10684008: Improve WebSocket and Storage docs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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 | « lib/html/doc/interface/Storage.dartdoc ('k') | no next file » | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // WARNING:
6 // This file contains documentation that is merged into the real source.
7 // Do not make code changes here.
8
9 /// @domName WebSocket 5 /// @domName WebSocket
6 /**
7 * Use the WebSocket interface to connect to a WebSocket,
8 * and to send and receive data on that WebSocket.
9 *
10 * To use a WebSocket in your web app, first create a WebSocket object,
11 * passing the WebSocket URL as an argument to the constructor.
12 *
13 * var webSocket = new WebSocket('ws://127.0.0.1:1337/ws');
14 *
15 * To send data on the WebSocket, use the [send] method.
16 *
17 * if (webSocket != null && webSocket.readyState == WebSocket.OPEN) {
18 * webSocket.send(data);
19 * } else {
20 * print('WebSocket not connected, message $data not sent');
21 * }
22 *
23 * To receive data on the WebSocket, register a listener for message events.
24 *
25 * webSocket.on.message.add((MessageEvent e) {
26 * receivedData(e.data);
27 * });
28 *
29 * The message event handler receives a [MessageEvent] object
30 * as its sole argument.
31 * You can also define open, close, and error handlers,
32 * as specified by [WebSocketEvents].
33 *
34 * For more information, see the
35 * [WebSockets](http://www.dartlang.org/docs/library-tour/#html-websockets)
36 * section of the library tour and
37 * [Introducing WebSockets](http://www.html5rocks.com/en/tutorials/websockets/ba sics/),
38 * an HTML5Rocks.com tutorial.
39 */
10 interface WebSocket extends EventTarget default _WebSocketFactoryProvider { 40 interface WebSocket extends EventTarget default _WebSocketFactoryProvider {
11 41
12 WebSocket(String url); 42 WebSocket(String url);
13 43
14 /** 44 /**
15 * @domName EventTarget.addEventListener, EventTarget.removeEventListener, Eve ntTarget.dispatchEvent 45 * @domName EventTarget.addEventListener, EventTarget.removeEventListener, Eve ntTarget.dispatchEvent
16 */ 46 */
17 WebSocketEvents get on(); 47 WebSocketEvents get on();
18 48
19 static final int CLOSED = 3; 49 static final int CLOSED = 3;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 interface WebSocketEvents extends Events { 94 interface WebSocketEvents extends Events {
65 95
66 EventListenerList get close(); 96 EventListenerList get close();
67 97
68 EventListenerList get error(); 98 EventListenerList get error();
69 99
70 EventListenerList get message(); 100 EventListenerList get message();
71 101
72 EventListenerList get open(); 102 EventListenerList get open();
73 } 103 }
OLDNEW
« no previous file with comments | « lib/html/doc/interface/Storage.dartdoc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698