mirror of
https://github.com/lovasoa/whitebophir
synced 2024-11-10 06:24:17 +00:00
Remove conditional spreading
This commit is contained in:
parent
12a741db39
commit
a0c45d9da4
1 changed files with 7 additions and 4 deletions
|
@ -64,15 +64,18 @@ Tools.connect = function () {
|
||||||
|
|
||||||
var url = new URL(window.location);
|
var url = new URL(window.location);
|
||||||
var params = new URLSearchParams(url.search);
|
var params = new URLSearchParams(url.search);
|
||||||
var token = params.get("token");
|
|
||||||
|
|
||||||
this.socket = io.connect('', {
|
var socket_params = {
|
||||||
...(token && {"query" : "token=" + token}),
|
|
||||||
"path": window.location.pathname.split("/boards/")[0] + "/socket.io",
|
"path": window.location.pathname.split("/boards/")[0] + "/socket.io",
|
||||||
"reconnection": true,
|
"reconnection": true,
|
||||||
"reconnectionDelay": 100, //Make the xhr connections as fast as possible
|
"reconnectionDelay": 100, //Make the xhr connections as fast as possible
|
||||||
"timeout": 1000 * 60 * 20 // Timeout after 20 minutes
|
"timeout": 1000 * 60 * 20 // Timeout after 20 minutes
|
||||||
});
|
}
|
||||||
|
if(params.has("token")) {
|
||||||
|
socket_params.query = "token=" + params.get("token");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.socket = io.connect('', socket_params);
|
||||||
|
|
||||||
//Receive draw instructions from the server
|
//Receive draw instructions from the server
|
||||||
this.socket.on("broadcast", function (msg) {
|
this.socket.on("broadcast", function (msg) {
|
||||||
|
|
Loading…
Reference in a new issue