triniwiz / nativescript-socketio

Socket.IO for nativescript
Apache License 2.0
71 stars 31 forks source link

ReferenceError: io is not defined #90

Open Catutigernos opened 5 years ago

Catutigernos commented 5 years ago

I check demo apps all of them is in Typescript. I am using Javascript and Vue. I generate project tns init and I load socketio module with tns plugin add. Project works fine, but when I added socketio plugin. I am getting "ReferenceError: io is not defined"

I checked previous issues and demo app. I saw same issues, but I tried everything and my problem is not solved.

Which platform(s) does your issue occur on?

Please, provide the following version numbers that your issue occurs with:

Please, tell us how to recreate the issue in as much detail as possible.

I generate template project with "tns init" command after that I add socketio module with "tns add plugin" command. After that, change app.js like below

import Vue from "nativescript-vue";

import Home from "./components/Home";
const SocketIO = require('nativescript-socketio').SocketIO;
const socket = new SocketIO('http://192.168.1.122:3000/', {});

new Vue({

    template: `
        <Frame>
            <Home />
        </Frame>`,

    components: {
        Home
    },    
    mounted: function() {
        socket.connect()
    }
}).$start();

If I remove socket io object from code. Code works fine, otherwise it gives "io is not defined" error. There is no any usage of socket module except app.js

Thanks in advance.