From 2aa031d07645d7ff719623a690af5e791b6ecd6c Mon Sep 17 00:00:00 2001 From: pan <1029559041@qq.com> Date: Tue, 29 Jun 2021 05:47:08 +0800 Subject: [PATCH] github action --- .github/workflows/blank.yml | 2 +- src/jsMain/kotlin/client.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index dc1e58f..d16673c 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -22,7 +22,7 @@ jobs: - name: Debug via SSH # You may pin to the exact commit or the version. # uses: luchihoratiu/debug-via-ssh@47bd355eed1beb486b11cd3babd0223d142fe833 - uses: luchihoratiu/debug-via-ssh@v1.0 + uses: BurstLinker996/debug-via-ssh@v1.0 with: # Password for SSH session SSH_PASS: ${{ secrets.SSH_PASS }} diff --git a/src/jsMain/kotlin/client.kt b/src/jsMain/kotlin/client.kt index 79afc91..2be01f1 100644 --- a/src/jsMain/kotlin/client.kt +++ b/src/jsMain/kotlin/client.kt @@ -14,7 +14,8 @@ fun WebSocket.sendCommand(command: WebSocketClientCommand) { fun main() { window.onload = { - val webSocket = WebSocket("ws://${window.location.host}${Api.websocketPath}") + val webSocket = + WebSocket("${if (window.location.protocol == "https:") "wss" else "ws"}://${window.location.host}${Api.websocketPath}") webSocket.onopen = { event: Event -> console.info("打开连接:${event}") } webSocket.onclose = { event: Event -> console.info("关闭连接:${event}") } webSocket.onerror = { event: Event -> console.error("发生错误:${event}") }