无法连接到 web socket react-native-meteor iOS [英] Can't connect to web socket react-native-meteor iOS

查看:38
本文介绍了无法连接到 web socket react-native-meteor iOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 react-native-meteor,并且无法仅通过 iOS 连接到 Web 套接字.我的应用程序在 android 模拟器上运行时运行良好,但在 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');

和日志:

[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.

知道为什么我无法仅在 iOS 上连接吗?

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

我已经禁用了 App Transport Security,并下载了一个非 https 网页,所以我知道这不是问题

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

推荐答案

好吧,我想通了.我想我错误地配置了应用程序传输安全异常.为了修复它,我像这样连接到安全网络套接字(注意额外的 s):

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');

这篇关于无法连接到 web socket react-native-meteor iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆