-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathevents.ts
53 lines (49 loc) · 1.51 KB
/
events.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { Message } from "./messages"
import { RoomKind } from "./provider"
export const MessageEmitted = "MessageEmitted"
/**
* Deduplicated (will not emit this event when a duplicate event comes in)
*/
export const MessageReceived = "MessageReceived"
/**
* When an incoming message fails to deserialize to JSON
*/
export const DeserializationError = "DeserializationError"
export const SocketClosed = "SocketClosed"
export const SocketOpened = "SocketOpened"
export const SocketError = "SocketError"
/**
* When a state or function tries to subscribe to a room with the same name
*/
export const RoomCollisionPrevented = "RoomCollisionPrevented"
export const RoomSubscribed = "RoomSubscribed"
export const RoomUnsubscribed = "RoomUnsubscribed"
export const RoommateSubscribed = "RoommateSubscribed"
export const RoommateUnsubscribed = "RoommateUnsubscribed"
export const DuplicateMessageReceived = "DuplicateMessageReceived"
/**
* When we don't get a ping from the server within the timeout
*/
export const PingIntervalTimeout = "PingIntervalTimeout"
export interface EventPayload {
/**
* If the event is based on a WebSocket event, or failure processing a message
*/
event?: MessageEvent<any>
/**
* If the event is based on the successfully parsed contents of a message
*/
msg?: Message
/**
* If based on a room operation
*/
roomID?: string
/**
* If based on a room operation
*/
roomKind?: RoomKind
/**
* RoommateSubscribed and RoommateUnsubscribed events
*/
clientID?: string
}