diff --git a/nuxt.config.js b/nuxt.config.js index 42b9509..22043bf 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -31,8 +31,6 @@ module.exports = { }, io: { - reconnection: true, - reconnectionDelayMax: 10000, sockets: [{ name: 'main', url: process.env.SERVER_URL || 'http://localhost:5301' diff --git a/pages/scan.vue b/pages/scan.vue index 4690cbb..bb022e6 100644 --- a/pages/scan.vue +++ b/pages/scan.vue @@ -172,7 +172,7 @@ export default { }, submitEvents(key) { - console.log('this.socket: ', this.socket); + // console.log('this.socket: ', this.socket); // log to "terminal" this.socket.on("status" + key, (msg, cb) => { @@ -219,22 +219,26 @@ export default { async mounted() { this.socket = this.$nuxtSocket({ channel: "/", + reconnection: true, + reconnectionDelayMax: 10000, + teardown: false, }); /* Listen for events: */ - /* this.socket.on("disconnect", () => { + this.socket.on("connect", () => { + this.socket.emit('auth', this.$store.state.user); + }); + + this.socket.on("disconnect", () => { this.log.push('server disconnected'); + this.running = ''; }); this.socket.on("reconnect_attempt", () => { - this.log.push('server reconnected'); + this.log.push('try to connect ' + this.serverUrl + '...'); }); - this.socket.on("reconnect", () => { - this.log.push('server reconnected'); - }); */ - firebase.auth().onAuthStateChanged(user => { // if (!user) user = { uid: 'anon' + Math.random() * 100000} this.socket.emit('auth', this.$store.state.user);