summaryrefslogtreecommitdiff
path: root/common/packets.d.ts
blob: 776f12f266cbb07b4e5e7f31450cd17124bb8cd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// copy pasted from dom.lib.d.ts because it can not be referenced in the server.
type F_RTCSdpType = "answer" | "offer" | "pranswer" | "rollback";
interface F_RTCSessionDescriptionInit { sdp?: string; type: F_RTCSdpType; }
interface F_RTCIceCandidateInit { candidate?: string; sdpMLineIndex?: number | null; sdpMid?: string | null; usernameFragment?: string | null; }

export interface PacketC {
    sender: string,
    data?: PacketS,
    join?: boolean, // user just joined
    leave?: boolean, // user left
    stable?: boolean // user "joined" because you joined aka. user was already there
}
export interface PacketS {
    receiver?: string
    ice_candidate?: F_RTCIceCandidateInit
    offer?: F_RTCSessionDescriptionInit
    answer?: F_RTCSessionDescriptionInit
}