emit

suspend fun emit(event: String, data: Any, acknowledgment: Boolean = false, timeout: Long = 5000): SocketSession

Emits an event with data to the WebSocket client, optionally requiring an acknowledgment.

Return

The updated SocketSession instance.

Parameters

event

The event name.

data

The data to send with the event.

acknowledgment

Whether an acknowledgment is required (default is false).

timeout

The timeout for acknowledgment (default is 5000ms).