Skip to content

QueueSocket beta ​

Interface of @v12-engine/client

ts
export interface QueueSocket

What the list waits in a queue by: a browser's WebSocket, or what a test gives

Members ​

addEventListener ​

ts
addEventListener?(event: 'open', listener: () => void): void;

Calls the listener once the socket is open; absent on a stand-in that is open already

close ​

ts
close(): void;

Closes the socket

onclose ​

ts
onclose?: (() => void) | null;

Called when the socket is closed

onmessage ​

ts
onmessage: ((event: {
        data: unknown;
    }) => void) | null;

Called with each message the server sends; its data is the text

readyState ​

ts
readyState?: number;

The socket's state as WebSocket numbers it (1 is open); undefined for a stand-in with none

send ​

ts
send(text: string): void;

Sends text to the server, such as a request to join the queue