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/.
6 * The origin of this IDL file is
7 * http://www.whatwg.org/html/#network
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.
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;
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;
35 attribute EventHandler onopen;
37 attribute EventHandler onerror;
39 attribute EventHandler onclose;
41 readonly attribute DOMString extensions;
43 readonly attribute DOMString protocol;
46 void close([Clamp] optional unsigned short code, optional DOMString reason);
50 attribute EventHandler onmessage;
52 attribute BinaryType binaryType;
55 void send(DOMString data);
61 void send(ArrayBuffer data);
64 void send(ArrayBufferView data);