This commit is contained in:
Sam 2021-07-19 18:26:00 +02:00
commit 02230930c5
2 changed files with 7 additions and 4 deletions

View file

@ -50,7 +50,6 @@ let needSetup = false;
version,
})
console.log('a user connected');
totalClient++;
if (needSetup) {
@ -59,7 +58,6 @@ let needSetup = false;
}
socket.on('disconnect', () => {
console.log('user disconnected');
totalClient--;
});

View file

@ -35,7 +35,8 @@ export default {
window.addEventListener('resize', this.onResize);
let wsHost;
if (localStorage.dev === "dev") {
const env = process.env.NODE_ENV || "production";
if (env === "development" || localStorage.dev === "dev") {
wsHost = ":3001"
} else {
wsHost = ""
@ -45,6 +46,10 @@ export default {
transports: ['websocket']
});
socket.on("connect_error", (err) => {
console.error(`Failed to connect to the backend. Socket.io connect_error: ${err.message}`);
});
socket.on('info', (info) => {
this.info = info;
});
@ -158,7 +163,7 @@ export default {
},
getSocket() {
return socket;
return socket;
},
toastRes(res) {