NathanaelA/nativescript-websockets

Getting 1006 code on iOS

Opened this issue · 1 comments

I'm getting 1006 code on iOS. It is working fine on Android. You can also see in code if I'm doing wrong so please let me correct.

            var mySocket = new WebSocket("wss://eu.rtm.tiledesk.com/v2/ws/?token=JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1ZWJkODkwMjkyYmVmZTAwMTkwNTQ5NzMiLCJlbWFpbCI6ImFuZHJlYWxlb0B0aWxlZGVzay5jb20iLCJmaXJzdG5hbWUiOiJBbmRyZWEiLCJsYXN0bmFtZSI6IkxlbyIsImVtYWlsdmVyaWZpZWQiOnRydWUsImlhdCI6MTYwMTQ3NTYyMywiYXVkIjoiaHR0cHM6Ly90aWxlZGVzay5jb20iLCJpc3MiOiJodHRwczovL3RpbGVkZXNrLmNvbSIsInN1YiI6InVzZXIiLCJqdGkiOiJlMGZjYjkxZC1mNzg5LTRiZDItODUyMC0zZDlkNzNiNGEyMDUifQ.ZGdoGhiW80DpPBiJ5WL3TEogwj3u1zSTtDseLUf2U0s", []);
            mySocket.addEventListener('open', function (evt) { console.log("We are Open"); });
            mySocket.addEventListener('message', function (evt) { console.log("We got a message: ", (evt as any).data); (evt as any).target.close(); });
            mySocket.addEventListener('close', function (evt) { console.log("The Socket was Closed:", evt.code, evt.reason); console.log(evt) });
            mySocket.addEventListener('error', function (evt) { console.log("The socket had an error", (evt as any).error); console.log(evt) });

It would be great if you could solve this issue. Thanks

This might be caused by: ?token=JWT eyJhb.. See that space in there, it probably needs to be changed to a %20. Can you see if that would fix it.