vue-socket.io socketio is not defined

Asked By: Anonymous

I’m trying to use vue-socket.io package here, so I did install it first then imported it in the app.js file, but in the Vue.use line the socketio throws a console error Uncaught ReferenceError: socketio is not defined:

npm install vue-socket.io --save

import VueSocketio from 'vue-socket.io';
Vue.use(VueSocketio, socketio('http://localhost:3000'), store);

Solution

Answered By: Anonymous

The documentation suggests a default configuration.

import VueSocketio from 'vue-socket.io';
Vue.use(VueSocketio, 'http://socketserver.com:1923');

If you want to use the one you’re using

import VueSocketio from 'vue-socket.io';
Vue.use(VueSocketio, socketio('http://localhost:3000'), store);

You’re going to have to import socketio from somewhere. Your script doesn’t know what that is. Looking at the source suggests that you could do this:

import VueSocketio from 'vue-socket.io';
import socketio from 'socket.io-client'

Vue.use(VueSocketio, socketio('http://localhost:3000'), store);
techinplanet staff

techinplanet staff


Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen windows office 365 satın al follower kaufen instagram follower kaufen porno