title: Vue socket io does not work (cannot get it to fire connection events)
body: <p>I am trying to build a multiplayer game with a client - server model.
  I am using nodejs, with a vuejs (version 2.5) project. However, I cannot seem to get the connections (using <em>socket.io-client</em> and <em>vue-socket.io</em>) to work.</p>
  
  <p>In 'main.js' i have the following code:</p>
  
  <pre><code>import Vue from 'vue';
  import App from './App.vue';
  import io from 'socket.io-client';
  import VueSocketio from 'vue-socket.io';
  
  export const socket = io('http://localhost:8080');
  
  socket.on('connection', function() {
    console.log('connected!');
  });
  Vue.use(VueSocketio, socket);
  
  console.log('imports done...');
  
  Vue.config.productionTip = false
  
  
  new Vue({
    render: h =&gt; h(App),
    sockets: {
      connect() {
        console.log('socket connected...');
      },
      disconnect() {
        console.log('socket disconnected...');
      }
    }
  }).$mount('#app')
  </code></pre>
  
  <p>When I open the page in the browser I do see the 'imports done...' in the console, however when I open or close additional browser tabs with localhost:8080, I see no messages in either the new window or the first window I opened with localhost:8080.</p>
  
  <p>I also tried putting the sockets syntax in the App.vue file, but that also did not work. I see the message 'App.vue script test.' appear in the console, but no connect or disconnect messages appearing in the console.</p>
  
  <pre><code>&lt;template&gt;
    &lt;div id="app"&gt;
      &lt;img alt="Vue logo" src="./assets/logo.png"&gt;
      &lt;HelloWorld msg="Welcome to Your Vue.js App"/&gt;
    &lt;/div&gt;
  &lt;/template&gt;
  
  &lt;script&gt;
  import HelloWorld from './components/HelloWorld.vue'
  
  console.log('App.vue script test.');
  
  export default {
    name: 'app',
    components: {
      HelloWorld
    },
    sockets: {
      connect() {
        console.log('App.vue: client connected...');
      },
      disconnect() {
        console.log('App.vue: client disconnected...');
      }
    }
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>Would anyone know how to solve this problem?
  Thanks in advance.</p>