fix websocket
This commit is contained in:
@@ -123,7 +123,9 @@ setInterval(() => {
|
|||||||
}, 100)
|
}, 100)
|
||||||
|
|
||||||
function createSession() {
|
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 = () => {
|
store.ws.onopen = () => {
|
||||||
const quiz = yaml.load(yamlInput.value)
|
const quiz = yaml.load(yamlInput.value)
|
||||||
store.send({ action: 'CREATE_SESSION', quiz })
|
store.send({ action: 'CREATE_SESSION', quiz })
|
||||||
|
|||||||
@@ -77,7 +77,11 @@ const myScore = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
function joinGame() {
|
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 = () => {
|
store.ws.onopen = () => {
|
||||||
joined.value = true
|
joined.value = true
|
||||||
// If we join mid-game, this ensures we see the right state
|
// If we join mid-game, this ensures we see the right state
|
||||||
|
|||||||
Reference in New Issue
Block a user