import { PartySocket } from 'partysocket'; export interface WebRTCEvents { peerlist: (peers: string[]) => void; socket: (ws: PartySocket) => void; datachannel: (dc: RTCDataChannel) => void; peer: (arg: [string, RTCDataChannel]) => void; 'peer-disconnect': (peerId: string) => void; 'webrtc-close': (dc: RTCDataChannel) => void; message: (ev: { data: string; peer: string; }) => void | Promise; } export declare class Connection { polite: boolean; readonly socket: InstanceType; private _gotInfo; private emitter; private pc?; private dc?; private host; private rtcState; peerIdByChannel: Map; connections: string[]; constructor({ host, room }: { host: string; room: string; }); private listenToSocket; close(): void; peerDisconnect(): void; private webrtc; private listenToDataChannel; /** * In here, do the RTC negotiation. * We assign the first peer to connect to the ws the **polite** role. */ connectToPeer(peerId: string, channelName?: string): Promise; on(event: K, callback: WebRTCEvents[K]): () => void; once(ev: K, cb: WebRTCEvents[K]): void; send(msg: string | Blob | ArrayBuffer | ArrayBufferView): void; } /** * Return a new Connection instance. This promise resolves when the websocket * is connected. After that, you need to call `connectToPeer` on the Connection. * * @returns {Promise} A promise that resolves when the * socket connects. */ export declare function connect({ host, room }: { host: string; room: string; }): Promise; //# sourceMappingURL=index.d.ts.map