triniwiz / nativescript-socketio

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

this.socket.connect is not a function #103

Closed kambl4 closed 3 years ago

kambl4 commented 3 years ago

ns version 8.0.2 "nativescript-vue": "~2.9.0", "@triniwiz/nativescript-socketio": "^4.0.1"

In my app.js

import { SocketIO } from '@triniwiz/nativescript-socketio';
const socketIO = new SocketIO(SOCKET_URL, {});

new Vue({
  render: (h) => h('frame', [h(Login)]),
  mounted () {
    socketIO.connect();
  }
}).$start()

After I run ns run ios I'm getting this error

(CoreFoundation) *** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: 
Uncaught TypeError: this.socket.connect is not a function
at
connect(file: app/webpack:/hivlife-app/node_modules/@triniwiz/nativescript-socketio/index.ios.js:154:0)
at mounted(file: app/webpack:/hivlife-app/app/app.js:45:0)

How to fix?

triniwiz commented 3 years ago

I need to publish a fix for that the pod needs to point to the previous branch

triniwiz commented 3 years ago

Give @triniwiz/nativescript-socketio@4.0.2 a try an lmk or you can update to 5.0.0 to use the latest socket.io servers

kambl4 commented 3 years ago

@triniwiz/nativescript-socketio@4.0.2 works! Thank you 😃