no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / dom / webidl / WebSocket.webidl
blob90d0da38e79ea46361fa5c26b0f0fabcf34ac8d9
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4  * You can obtain one at http://mozilla.org/MPL/2.0/.
5  *
6  * The origin of this IDL file is
7  * http://www.whatwg.org/html/#network
8  *
9  * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and Opera Software ASA.
10  * You are granted a license to use, reproduce and create derivative works of this document.
11  */
13 enum BinaryType { "blob", "arraybuffer" };
15 [Exposed=(Window,Worker)]
16 interface WebSocket : EventTarget {
17   [Throws]
18   constructor(DOMString url, optional (DOMString or sequence<DOMString>) protocols = []);
20   readonly attribute DOMString url;
22   // ready state
23   const unsigned short CONNECTING = 0;
24   const unsigned short OPEN = 1;
25   const unsigned short CLOSING = 2;
26   const unsigned short CLOSED = 3;
28   readonly attribute unsigned short readyState;
30   readonly attribute unsigned long long bufferedAmount;
32   // networking
34   attribute EventHandler onopen;
36   attribute EventHandler onerror;
38   attribute EventHandler onclose;
40   readonly attribute DOMString extensions;
42   readonly attribute DOMString protocol;
44   [Throws]
45   undefined close(optional [Clamp] unsigned short code, optional DOMString reason);
47   // messaging
49   attribute EventHandler onmessage;
51   attribute BinaryType binaryType;
53   [Throws]
54   undefined send(DOMString data);
56   [Throws]
57   undefined send(Blob data);
59   [Throws]
60   undefined send(ArrayBuffer data);
62   [Throws]
63   undefined send(ArrayBufferView data);
66 // Support for creating server-side chrome-only WebSocket. Used in
67 // devtools remote debugging server.
68 interface nsITransportProvider;
70 partial interface WebSocket {
71   [ChromeOnly, NewObject, Throws]
72   static WebSocket createServerWebSocket(DOMString url,
73                                          sequence<DOMString> protocols,
74                                          nsITransportProvider transportProvider,
75                                          DOMString negotiatedExtensions);