happones / nativescript-laravel-echo

A nativescript plugin for laravel-echo
Apache License 2.0
10 stars 2 forks source link

Can't get socket ID? #19

Open butaminas opened 4 years ago

butaminas commented 4 years ago

Which platform(s) does your issue occur on?

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

"version": "6.5.1"

"tns-android": { "version": "6.5.0" }

"dependencies": { "@nota/nativescript-webview-ext": "^5.4.1", "axios": "^0.19.0", "js-cookie": "^2.2.1", "nativescript-advanced-permissions": "^1.2.0", "nativescript-camera": "^4.5.0", "nativescript-dna-deviceinfo": "^2.4.3", "nativescript-geolocation": "^5.1.0", "nativescript-laravel-echo": "^1.2.0", "nativescript-local-notifications": "^4.1.4", "nativescript-phone": "^1.4.1", "nativescript-plugin-firebase": "^9.1.1", "nativescript-theme-core": "^2.0.24", "nativescript-toast": "^2.0.0", "nativescript-toasts": "^1.0.3", "nativescript-ui-sidedrawer": "^7.0.2", "nativescript-vue": "~2.4.0", "net": "^1.0.2", "rxjs": "^6.5.5", "tns-core-modules": "^6.5.1", "tns-platform-declarations": "^6.3.2", "typescript": "^3.9.3", "vuex": "^3.4.0" }, "devDependencies": { "@babel/core": "~7.1.0", "@babel/preset-env": "~7.1.0", "babel-loader": "~8.0.0", "nativescript-dev-webpack": "^1.5.1", "nativescript-vue-template-compiler": "~2.4.0", "node-sass": "^4.14.1", "vue-loader": "~15.4.0" },

I'm using this in the same way as it is described in the demo. Here is how my options look like:

const options = {
    broadcaster: 'socket.io',
    host: 'https://domainhere.com/ws/socket.io',
    headers: {
            Authorization: 'Bearer ' + token
    },
    debug: true
}
const Echo = new TnsEcho(options)

After this, I'm trying to get the socket ID like this: console.log('scoketID: ', Echo.socketId()) Unfortunately, I get null.

I am using Laravel Echo on VUE (web part) in a similar way without a problem. Am I missing something? Why doesn't it connect? Anything I can do to get more information about the connection?

ejlocop commented 3 years ago

I got a similar case, it looks like the TnsEcho object doesn't have socketId method.

installed version is: 1.2.0

image