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:// (or http:///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)

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.2 on Genymotion).

  • Physical device / iOS simulator or device — use the machine's LAN IP (e.g. 192.168.1.100; find it with ipconfig getifaddr en0 on macOS).

  • Desktop / JVMlocalhost works as expected.

Constructors

Link copied to clipboard
constructor(url: String, port: Int? = null, isSecure: Boolean = true, authenticationToken: String? = null)

Properties

Link copied to clipboard

optional token sent as the first message once the connection is open (e.g. a JWT, API key, or session token).

Link copied to clipboard

when url has no scheme, selects wss/https (true, the default) or ws/http (false); ignored when url includes a scheme.

Link copied to clipboard
val port: Int?

port to append when url has no scheme; ignored when url already includes one.

Link copied to clipboard

The HTTP URL for POST-based steps: url verbatim if it already carries a scheme, otherwise composed from url, isSecure (https/http), and port.

Link copied to clipboard
val url: String

a full WebSocket URL (production), or a host/IP composed with port and isSecure (development).

Link copied to clipboard

The WebSocket URL to connect to: url verbatim if it already carries a scheme, otherwise composed from url, isSecure (wss/ws), and port.