Bumping gaia.json for 2 gaia revision(s) a=gaia-bump
[gecko.git] / dom / webidl / WebSocket.webidl
blobc1965cb6fc40c08e43d03d31b925299c4b0317a6
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 [Func="mozilla::dom::WebSocket::PrefEnabled",
16  Constructor(DOMString url),
17  Constructor(DOMString url, DOMString protocols),
18  Constructor(DOMString url, sequence<DOMString> protocols)]
19 interface WebSocket : EventTarget {
21   readonly attribute DOMString url;
23   // ready state
24   const unsigned short CONNECTING = 0;
25   const unsigned short OPEN = 1;
26   const unsigned short CLOSING = 2;
27   const unsigned short CLOSED = 3;
29   readonly attribute unsigned short readyState;
31   readonly attribute unsigned long bufferedAmount;
33   // networking
35   attribute EventHandler onopen;
37   attribute EventHandler onerror;
39   attribute EventHandler onclose;
41   readonly attribute DOMString extensions;
43   readonly attribute DOMString protocol;
45   [Throws]
46   void close([Clamp] optional unsigned short code, optional DOMString reason);
48   // messaging
50   attribute EventHandler onmessage;
52   attribute BinaryType binaryType;
54   [Throws]
55   void send(DOMString data);
57   [Throws]
58   void send(Blob data);
60   [Throws]
61   void send(ArrayBuffer data);
63   [Throws]
64   void send(ArrayBufferView data);