fix websocket
This commit is contained in:
@@ -123,7 +123,9 @@ setInterval(() => {
|
||||
}, 100)
|
||||
|
||||
function createSession() {
|
||||
store.connect(`ws://${window.location.hostname}:8000/ws/host`)
|
||||
const proto = window.location.protocol === 'https:' ? 'wss:' : 'ws:'
|
||||
const port = window.location.port
|
||||
store.connect(`${proto}//${window.location.hostname}:${port}/ws/host`)
|
||||
store.ws.onopen = () => {
|
||||
const quiz = yaml.load(yamlInput.value)
|
||||
store.send({ action: 'CREATE_SESSION', quiz })
|
||||
|
||||
@@ -77,7 +77,11 @@ const myScore = computed(() => {
|
||||
})
|
||||
|
||||
function joinGame() {
|
||||
store.connect(`ws://${window.location.hostname}:8000/ws/play/${code.value}/${name.value}`)
|
||||
const proto = window.location.protocol === 'https:' ? 'wss:' : 'ws:'
|
||||
const port = window.location.port
|
||||
store.connect(
|
||||
`${proto}://${window.location.hostname}:${port}/ws/play/${code.value}/${name.value}`,
|
||||
)
|
||||
store.ws.onopen = () => {
|
||||
joined.value = true
|
||||
// If we join mid-game, this ensures we see the right state
|
||||
|
||||
Reference in New Issue
Block a user