Search code examples
iosreact-nativereact-native-meteor

Can't connect to web socket react-native-meteor iOS


I'm using react-native-meteor, and am having trouble connecting to the web socket with iOS only. My application works just fine when running on the android simulator, but just doesn't work in iOS simulator or device. This is my code:

Meteor.connect('ws://app.mysite.com/websocket');

And the logs:

[info][tid:main][RCTBatchedBridge.m:72] Initializing <RCTBatchedBridge: 0x7fe23b23d4c0> (parent: <RCTBridge: 0x7fe239d65090>, executor: RCTJSCExecutor)
[warn][tid:main][RCTEventEmitter.m:54] Sending `websocketFailed` with no listeners registered.


Disconnected from DDP server.

Any idea why I can't connect on iOS only?

I have already disabled App Transport Security, and downloaded a non-https webpage, so I know that's not the problem


Solution

  • Well I figured it out. I think I had incorrectly configured the app transport security exception. To fix it, I connected to the secure web socket like this (note the extra s):

    Meteor.connect('wss://app.mysite.com/websocket');