socket.io-client icon indicating copy to clipboard operation
socket.io-client copied to clipboard

SocketRocket: In debug mode. Allowing connection to any root cert (react native iOS)

Open usamaabutt opened this issue 3 years ago • 3 comments

SocketRocket: In debug mode. Allowing connection to any root cert I am using socket.io in my react native project and socket connection process and its events are working fine on Android but at the same time, I am getting this above error while I tried to test on an iOS device.

Reproducable steps Install this package and run on iOS device and try to listen "connect" channel or any custom channel might be you will get the same error.

Socket.IO client version: 4.5.0

import {io} from 'socket.io-client';

const socket = io(config.API_BASE_URL, {
    withCredentials: true,
    extraHeaders: {
      Cookie: cookies,
    },
  });
  
    useMemo(() => {
    socket.on('connect', () => {
      checkConnection(socket.connected);
    });
  }, [socket]);

Expected behavior Socket.io should works as it is working fine for Android. It should get connected to "connect" channel or my custom channel.

Platform:

  • Device: [iPhone real device e.g. iPhone 6s]
  • OS: [OS 14.6]

usamaabutt avatar May 17 '22 11:05 usamaabutt

Hi, @darrachequesne can you please help me out to get rid of this situation.

usamaabutt avatar May 17 '22 12:05 usamaabutt

Try this: const socket = io(config.API_BASE_URL, { 'reconnection': true, 'reconnectionDelay': 50000, 'reconnectionDelayMax': 50000, 'reconnectionAttempts': 3, 'query': { apiKey: ‘APIKEY’, type: ‘Type’ }, transports: ['websocket'], });

usmanabid94 avatar May 18 '22 04:05 usmanabid94

@usmanabid94 that's not working for me. any other updates on this?

aliturab5125 avatar Dec 13 '22 06:12 aliturab5125

For future readers:

Please check our React Native guide here: https://socket.io/how-to/use-with-react-native

Please reopen if needed.

darrachequesne avatar Apr 08 '24 16:04 darrachequesne