happones / nativescript-laravel-echo

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

Not working in IOS #10

Closed dungfv closed 5 years ago

dungfv commented 5 years ago

I am using this plugin with Nativescript-Vue latest. It work fine on Android, but not working for IOS. I cannot connect to socket server, do not have any log. Even the sample application doesn't work for IOS

happones commented 5 years ago

try this:

  1. if your endpoint isn't https add `NSAppTransportSecurity

    NSAllowsArbitraryLoads

    intoinfo.plist`

  2. Or try setTimeout


const Echo = new TnsEcho(options);
setTimeout(() => {
    Echo.private('channel');
}, 1000);
dungfv commented 5 years ago

Thanks for your help. It worked with setTimeout for my case. But why must setTimeout and need setTime for seconds for specific contexts, does it depend on network speed?

happones commented 5 years ago

Rather it is a theme of the operating system, the optimal way to invoke Echo would be:


<Page @loaded="onLoaded">//Or the component that is GridLayout, etc
</Page>
created() {}, // Not
mounted(){}, // With timeout
methods: {
    onLoaded() {
        const Echo = new TnsEcho(options);
        Echo.private('channel');
    }
}
``` try
dungfv commented 5 years ago

I known, thankyou verry much