export interface ProtocolPacketBase { version: number; minimumVersion?: number; type: string; payload?: any; } export interface ClassicProtocolOffer extends ProtocolPacketBase { type: 'classic'; } export interface RTCProtocolOffer extends ProtocolPacketBase { type: 'rtc'; payload: { offer: RTCSessionDescriptionInit; rtcConnectionId: string; }; } export type ProtocolOffer = ClassicProtocolOffer | RTCProtocolOffer; /** * Protocol values for determining channel messaging strategy. */ export type MessagingProtocols = ProtocolOffer['type']; export type LocalSupportedProtocol = { type: MessagingProtocols; minimumVersion: number; version: number; }; export interface ExternalClientOffer { maxProtocols: number; supportedProtocols: ProtocolPacketBase[]; } export interface ClientOffer { supportedProtocols: ProtocolOffer[]; maxProtocols: number; } export interface ClassicProtocolAnswer extends ProtocolPacketBase { type: 'classic'; } export interface RTCProtocolAnswer extends ProtocolPacketBase { type: 'rtc'; payload: { answer: RTCSessionDescriptionInit; }; } export type ProtocolAnswer = ClassicProtocolAnswer | RTCProtocolAnswer; export interface ClientAnswer { supportedProtocols: ProtocolAnswer[]; }