dwrtc / ch.hsr.dsl.dwrtc.websocket / WebSocketHandler

WebSocketHandler

class WebSocketHandler

Main handler class

Parameters

app - the Javalin app

Types

Companion

companion object Companion : KLogging

Logging companion

Constructors

<init>

WebSocketHandler(app: Javalin, signallingService: ClientService)

sets up the WebSocket path and various handlers

Properties

clients

val clients: ConcurrentHashMap<String, IInternalClient>

Map of session ID to InternalClient

sessions

val sessions: ConcurrentHashMap<String, WsSession>

Map of session ID to WebSocket session

signallingService

val signallingService: ClientService

the underlying ClientService

Functions

close

fun close(session: WsSession, reason: String): Unit

Handler for when a WebSocket session closes

connect

fun connect(session: WsSession): Unit

Handler for new WebSocket connections

onReceiveMessageFromSignaling

fun onReceiveMessageFromSignaling(message: ClientMessage): Unit

Handler for a new message from the P2P layer

onReceiveMessageFromWebSocket

fun onReceiveMessageFromWebSocket(session: WsSession, message: String): Unit

Handler for a new message from the WebSocket