Irfan wani
Irfan wani

Reputation: 5055

Error: WebSocket closed wss://my.websocket.server:port (code: 1006)] sip.js react native

I am integrating sipjs in react native and here is the code;

import {Registerer, UserAgent} from 'sip.js';

export const registerUserAgent = async () => {
  try {

    let sipUsername = 'my username';
    let sipToken = 'my token';

    const userAgentOptions = {
      transportOptions: {
        server: 'wss://my.websocket.server:port',
        traceSip: true,
      },
      logLevel: 'debug',
    };

    userAgentOptions.uri = UserAgent.makeURI(
      `sip:${sipUsername}@my.websocket.server:port`,
    );

    let userAgent = new UserAgent(userAgentOptions);
    userAgent.delegate = {
      onDisconnect(err) {
        console.log(err, 'Disconnect error');
      },
    };
    await userAgent.start();
 

  } catch (err) {
    console.log(err);
  }
};

But the userAgent never starts, it throws an error;

Error: WebSocket closed wss://my.websocket.server:port (code: 1006)]

I am not sure what is going wrong here. Note that the server is working fine.

And this issue is only with android. On iOS everything works fine.

Upvotes: 0

Views: 935

Answers (1)

nucr0t
nucr0t

Reputation: 61

  1. Locate the problem
Clent Network Server
Running code in debugging mode Traffic sniffing Extended logging
  1. In general, try to detect the presence or absence of network packets on the client, on the hardware, and on the server alternately. Start with the server, e.g. run tcpdump there. And see if network requests to the specified port from the specified address are received.

It's probably a systemic problem. Try to see the development status or similar errors.

Upvotes: 0

Related Questions