webSocketEvents
suspend fun HttpClient.webSocketEvents(reference: EventReference, path: String = Routes.DEFAULT_EVENTS_ROUTE, block: suspend DefaultClientWebSocketSession.() -> Unit)
Opens a block with DefaultClientWebSocketSession associated with the given event reference and optional path.
Example usage:
client.webSocketEvents(ref("book_updated", "<book_id>")) {
val event: WebSocketEvent<Book> = receiveWebSocketEvent()
println(event.data.author)
}
Content copied to clipboard
See also
Throws
if WebSocketEvents plugin is not installed.