Fix websocket path
This commit is contained in:
parent
07d22e2de5
commit
15d2b3d670
@ -4,6 +4,11 @@
|
||||
|
||||
const apiPath = "/schafkopf"
|
||||
|
||||
function webSocketPath() {
|
||||
const prefix = (window.location.protocol === "https:") ? "wss://" : "ws://"
|
||||
return prefix + window.location.host + apiPath + "/session/start"
|
||||
}
|
||||
|
||||
async function performRegisterPlayerRequest(name, password) {
|
||||
return fetch(apiPath + "/player/register/" + name, { method: 'POST', body: password })
|
||||
.then(convertServerResponse)
|
||||
|
@ -174,7 +174,8 @@ function leaveTable() {
|
||||
}
|
||||
|
||||
function openSocket(token) {
|
||||
socket = new WebSocket(((window.location.protocol === "https:") ? "wss://" : "ws://") + window.location.host + "/session/start")
|
||||
const socketPath = webSocketPath()
|
||||
socket = new WebSocket(socketPath)
|
||||
|
||||
socket.onopen = function(e) {
|
||||
socket.send(token);
|
||||
|
Loading…
Reference in New Issue
Block a user