Source code

Revision control

Other Tools

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
4
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
#include "domstubs.idl"
7
#include "nsISupports.idl"
8
9
[scriptable, builtinclass, uuid(6714a6be-2265-4f73-a988-d78a12416037)]
10
interface nsIWebSocketFrame : nsISupports
11
{
12
[must_use] readonly attribute DOMHighResTimeStamp timeStamp;
13
14
[must_use] readonly attribute boolean finBit;
15
16
[must_use] readonly attribute boolean rsvBit1;
17
[must_use] readonly attribute boolean rsvBit2;
18
[must_use] readonly attribute boolean rsvBit3;
19
20
[must_use] readonly attribute unsigned short opCode;
21
22
[must_use] readonly attribute boolean maskBit;
23
24
[must_use] readonly attribute unsigned long mask;
25
26
[must_use] readonly attribute ACString payload;
27
28
// Non-Control opCode values:
29
const unsigned short OPCODE_CONTINUATION = 0x0;
30
const unsigned short OPCODE_TEXT = 0x1;
31
const unsigned short OPCODE_BINARY = 0x2;
32
33
// Control opCode values:
34
const unsigned short OPCODE_CLOSE = 0x8;
35
const unsigned short OPCODE_PING = 0x9;
36
const unsigned short OPCODE_PONG = 0xA;
37
};
38
39
[scriptable, uuid(e7c005ab-e694-489b-b741-96db43ffb16f)]
40
interface nsIWebSocketEventListener : nsISupports
41
{
42
[must_use] void webSocketCreated(in unsigned long aWebSocketSerialID,
43
in AString aURI,
44
in ACString aProtocols);
45
46
[must_use] void webSocketOpened(in unsigned long aWebSocketSerialID,
47
in AString aEffectiveURI,
48
in ACString aProtocols,
49
in ACString aExtensions,
50
in uint64_t aHttpChannelId);
51
52
const unsigned short TYPE_STRING = 0x0;
53
const unsigned short TYPE_BLOB = 0x1;
54
const unsigned short TYPE_ARRAYBUFFER = 0x2;
55
56
[must_use] void webSocketMessageAvailable(in unsigned long aWebSocketSerialID,
57
in ACString aMessage,
58
in unsigned short aType);
59
60
[must_use] void webSocketClosed(in unsigned long aWebSocketSerialID,
61
in boolean aWasClean,
62
in unsigned short aCode,
63
in AString aReason);
64
65
[must_use] void frameReceived(in unsigned long aWebSocketSerialID,
66
in nsIWebSocketFrame aFrame);
67
68
[must_use] void frameSent(in unsigned long aWebSocketSerialID,
69
in nsIWebSocketFrame aFrame);
70
};
71
72
[scriptable, builtinclass, uuid(b89d1b90-2cf3-4d8f-ac21-5aedfb25c760)]
73
interface nsIWebSocketEventService : nsISupports
74
{
75
[must_use] void addListener(in unsigned long long aInnerWindowID,
76
in nsIWebSocketEventListener aListener);
77
78
[must_use] void removeListener(in unsigned long long aInnerWindowID,
79
in nsIWebSocketEventListener aListener);
80
81
[must_use] bool hasListenerFor(in unsigned long long aInnerWindowID);
82
};