A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/probil/vue-socket.io-extended/issues/61 below:

Cannot read property 'emit' of undefined · Issue #61 · probil/vue-socket.io-extended · GitHub

I've a .vue file like this:

<template>
  <div class="home">
    <h1>Hello</h1>
  </div>
</template>
<script>
export default {
  sockets: {
    connect: () => {
      this.$socket.emit("join_room", "abc");
    },
  }
};
</script>

and I'm getting an error: Uncaught TypeError: Cannot read property 'emit' of undefined

main.js

import VueSocketio from 'vue-socket.io-extended';
import io from 'socket.io-client';
import Vue from 'vue';

import App from './App.vue';

Vue.use(VueSocketio, io('http://localhost:4000'));

new Vue({
  render: h => h(App),
}).$mount('#app');

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4