Skip to content

Commit

Permalink
fix https下的连接wss
Browse files Browse the repository at this point in the history
  • Loading branch information
ac0d3r committed May 6, 2023
1 parent 121bbec commit 9317461
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion frontend/src/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const showInput = () => {
}
// records
const records: Ref<any[]> = ref([]);
const ws = new WebSocket(`ws://${window.location.host}/api/v2/user/record`)
const ws = new WebSocket(`${window.location.protocol === 'https:' ? 'wss' : 'ws'}://${window.location.host}/api/v2/user/record`)
ws.onmessage = (msg: any) => {
records.value.push(JSON.parse(msg.data));
}
Expand Down

0 comments on commit 9317461

Please sign in to comment.