2017-03-03 159 views
1

我们的反应原生应用程序有时会连接到我们的websocket(我们正在使用sockjs)。发生这种情况时,它会阻止所有网络请求,从本质上阻止我们的应用程序运行react-native websocket ERR_NAME_NOT_RESOLVED停止网络请求

当它发生时,控制台不停止记录:

GET http://192.168.0.11.xip.io:8080/sock/194/noeli4ep/eventsource 
net::ERR_NAME_NOT_RESOLVED 

这是我们的连接脚本,应用程序启动时运行,它也运行在插座关闭(这是为了让重新连接到插座)。

connectToServer() { 
    if (!this.flagConnect) { 
     this.webSocket = new SockJS(`${config.endpoint}sock`); 
     this.webSocket.onopen = this.onOpen; // Just sets this.opened to true 
     this.webSocket.onmessage = this.onMesssage; // Just reads the msgs 
     this.webSocket.onclose = this.onClose; // Re-calls connectToServer() 
     this.webSocket.onerror = this.onError; // Console.logs the error 
    } 
    } 

我们使用使用上的应用程序&后端(的NodeJS)sockJS阵营本地0.41 &。

回答

0

我发现删除xip.io解决了这个问题。

所以使用http://<ip>:><port>很好。