Add wss support
This commit is contained in:
parent
43e5bac871
commit
4f352de0d2
3 changed files with 7 additions and 4 deletions
|
@ -11,8 +11,11 @@ import org.w3c.dom.events.Event
|
|||
import kotlin.browser.window
|
||||
|
||||
class WebSocketClient() {
|
||||
val prefix = js("prefix")
|
||||
private val url = "ws://${window.location.host}$prefix/"
|
||||
private val prefix = js("prefix")
|
||||
|
||||
private val useSsl = "https" in window.location.protocol
|
||||
private val wsProtocol = if (useSsl) "wss" else "ws"
|
||||
private val url = "$wsProtocol://${window.location.host}$prefix/websocket"
|
||||
|
||||
private lateinit var ws: WebSocket
|
||||
private var reconnect = false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue