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

Error when connecting to socket server on iOS only [@triniwiz/nativescript-socketio] #158

Open
OPADA-Eng opened this issue Dec 21, 2022 · 0 comments

Comments

@OPADA-Eng
Copy link

Hi
I'm trying to use the plugin on iOS but it fails to connect to the socket server with error message:

error: error Invalid HTTP upgrade. code=308, type=upgradeError
ns version:

{
"dependencies": {
    "@nativescript/core": "^8.4.1",
    "@triniwiz/nativescript-socketio": "^4.0.3",
},
 "devDependencies": {
        "@nativescript/android": "~8.4.0",
        "@nativescript/ios": "8.4.0",
        "@nativescript/types": "~8.4.0",
        "@nativescript/webpack": "~5.0.9",
        "typescript": "~4.8.3"
    }
}

My Code:

let options = {
                transports: ['websocket'],
                query: {
                    room: roomName,
                    token: 'XXX',
                },
                android: {
                
                },
                ios: {
                    log: true,
                }
            }
          DOService.MySocket = new SocketIO(domain, options);
          DOService.MySocket.connect();

          DOService.MySocket.on('connect', function () {
              DOService.socketConnected = true;
              console.log('connected', DOService.socketConnected);
          });

          DOService.MySocket.on('disconnect', function (data) {
              console.log('disconnect', data);
              DOService.socketConnected = false;
          });

          DOService.MySocket.on('error', function (error) {
              console.dir('error', error);
          });

Can Anybody help?

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

1 participant