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

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

Issue 11691009: Moved most of html lib generating scripts into tools. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 | « sdk/lib/html/doc/interface/UIEvent.dartdoc ('k') | sdk/lib/html/docs/html_docs.json » ('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) 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
3 // BSD-style license that can be found in the LICENSE file.
4
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 */
40 abstract class WebSocket implements EventTarget {
41
42 factory WebSocket(String url) => _WebSocketFactoryProvider.createWebSocket(url );
43
44 /**
45 * @domName EventTarget.addEventListener, EventTarget.removeEventListener, Eve ntTarget.dispatchEvent
46 */
47 WebSocketEvents get on;
48
49 static const int CLOSED = 3;
50
51 static const int CLOSING = 2;
52
53 static const int CONNECTING = 0;
54
55 static const int OPEN = 1;
56
57 /** @domName WebSocket.URL */
58 abstract String get URL;
59
60 /** @domName WebSocket.binaryType */
61 String binaryType;
62
63 /** @domName WebSocket.bufferedAmount */
64 abstract int get bufferedAmount;
65
66 /** @domName WebSocket.extensions */
67 abstract String get extensions;
68
69 /** @domName WebSocket.protocol */
70 abstract String get protocol;
71
72 /** @domName WebSocket.readyState */
73 abstract int get readyState;
74
75 /** @domName WebSocket.url */
76 abstract String get url;
77
78 /** @domName WebSocket.addEventListener */
79 void $dom_addEventListener(String type, EventListener listener, [bool useCaptu re]);
80
81 /** @domName WebSocket.close */
82 void close([int code, String reason]);
83
84 /** @domName WebSocket.dispatchEvent */
85 bool $dom_dispatchEvent(Event evt);
86
87 /** @domName WebSocket.removeEventListener */
88 void $dom_removeEventListener(String type, EventListener listener, [bool useCa pture]);
89
90 /** @domName WebSocket.send */
91 void send(data);
92 }
93
94 abstract class WebSocketEvents implements Events {
95
96 EventListenerList get close;
97
98 EventListenerList get error;
99
100 EventListenerList get message;
101
102 EventListenerList get open;
103 }
OLDNEW
« no previous file with comments | « sdk/lib/html/doc/interface/UIEvent.dartdoc ('k') | sdk/lib/html/docs/html_docs.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698