WebsocketConfig
data class WebsocketConfig(val url: String, val port: Int? = null, val isSecure: Boolean = true, val authenticationToken: String? = null)
Endpoint and authentication settings for the default WebSocket transport.
There are two ways to specify the endpoint:
Full URL (production) — pass a complete
ws:///wss://(orhttp:///https://) URL as url. It is used verbatim; port and isSecure are ignored.Host plus parts (development) — pass a bare host or IP as url and let port and isSecure compose the scheme and port.
// Production
WebsocketConfig(url = "wss://mpc.example.com")
WebsocketConfig(url = "wss://mpc.example.com", authenticationToken = "jwt")
// Local development
WebsocketConfig(url = "localhost", port = 8080, isSecure = false)Content copied to clipboard
Reaching a host machine from a device
localhost resolves to the device or emulator itself, not your development machine. To reach a server on your machine:
Android emulator — use
10.0.2.2(10.0.3.2on Genymotion).Physical device / iOS simulator or device — use the machine's LAN IP (e.g.
192.168.1.100; find it withipconfig getifaddr en0on macOS).Desktop / JVM —
localhostworks as expected.