allow 2p url config, origin limiting for server

This commit is contained in:
Bui
2022-03-24 02:32:31 +00:00
parent 0c39e54d90
commit 7f511abb4f
4 changed files with 14 additions and 4 deletions

View File

@@ -32,7 +32,7 @@ class P2Connection{
if(this.closed && !this.disabled){
this.closed = false
var wsProtocol = location.protocol == "https:" ? "wss:" : "ws:"
this.socket = new WebSocket(wsProtocol + "//" + location.host + "/p2")
this.socket = new WebSocket(gameConfig.multiplayer_url ? gameConfig.multiplayer_url : wsProtocol + "//" + location.host + "/p2")
pageEvents.race(this.socket, "open", "close").then(response => {
if(response.type === "open"){
return this.openEvent()