Fix websocket path
This commit is contained in:
parent
07d22e2de5
commit
15d2b3d670
@ -4,12 +4,17 @@
|
||||
|
||||
const apiPath = "/schafkopf"
|
||||
|
||||
async function performRegisterPlayerRequest(name, password){
|
||||
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)
|
||||
}
|
||||
|
||||
async function performDeletePlayerRequest(name, password){
|
||||
async function performDeletePlayerRequest(name, password) {
|
||||
return fetch(apiPath + "/player/delete/" + name, { method: 'POST', body: password })
|
||||
.then(convertServerResponse)
|
||||
.then(function(value) {})
|
||||
|
@ -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