Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to connect server on both platforms #104

Open
danishashraf047 opened this issue Jul 11, 2021 · 4 comments
Open

Unable to connect server on both platforms #104

danishashraf047 opened this issue Jul 11, 2021 · 4 comments

Comments

@danishashraf047
Copy link

I'm not able to connect server on both platforms. I'm attaching source code. If I'm doing wrong so please let me correct.

            import { SocketIO } from '@triniwiz/nativescript-socketio';

            var socketIO = new SocketIO("wss://eu.rtm.tiledesk.com/v2/ws", {
                query: {
                    token: "JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1ZWJkODkwMjkyYmVmZTAwMTkwNTQ5NzMiLCJlbWFpbCI6ImFuZHJlYWxlb0B0aWxlZGVzay5jb20iLCJmaXJzdG5hbWUiOiJBbmRyZWEiLCJsYXN0bmFtZSI6IkxlbyIsImVtYWlsdmVyaWZpZWQiOnRydWUsImlhdCI6MTYwMTQ3NTYyMywiYXVkIjoiaHR0cHM6Ly90aWxlZGVzay5jb20iLCJpc3MiOiJodHRwczovL3RpbGVkZXNrLmNvbSIsInN1YiI6InVzZXIiLCJqdGkiOiJlMGZjYjkxZC1mNzg5LTRiZDItODUyMC0zZDlkNzNiNGEyMDUifQ.ZGdoGhiW80DpPBiJ5WL3TEogwj3u1zSTtDseLUf2U0s"
                },
                forceWebsockets: true
            });
            socketIO.connect();
            socketIO.on("close", () => {
                console.log('websocket is closed.');
            });
            socketIO.on("error", (error) => {
                console.log(error);
                console.log(error.toString());
                console.log('websocket error ...')
            });
            socketIO.on("message", () => {
                console.log('message.');
            });
            socketIO.on("connect", () => {
                console.log('websocket is connected.');
            });
            socketIO.on("open", () => {
                console.log('websocket is open.');
            });

Plugin version is 5.0.1
NS Android version is 7.0.1
NS iOS version is 8.0.0

I would be thankful if you could take your precious time to help me out.

@triniwiz
Copy link
Owner

Which version of socket.io is the server running ?

@danishashraf047
Copy link
Author

Which version of socket.io is the server running ?

Thanks for taking out your precious time. I'm trying to integrate this one https://developer.tiledesk.com/apis/realtime-api. I can't say which version is being used because I'm using their subscription. I also have tried "ws://echo.websocket.org" server with no luck. :(

@triniwiz
Copy link
Owner

This is for only socket.io servers if it's only websockets you need please use https://github.com/NathanaelA/nativescript-websockets/blob/master/src/README.md

@danishashraf047
Copy link
Author

This is for only socket.io servers if it's only websockets you need please use https://github.com/NathanaelA/nativescript-websockets/blob/master/src/README.md

I have tried this one, it is working fine on Android but getting 1006 error code on iOS. I also have created issue on their repo and waiting for someone help NathanaelA/nativescript-websockets#92 but didn't get any help till now. By the way, thank you so much to give your precious time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants