Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android应用程序Meteor后端的OpeningHandshakeException_Android_Meteor_Websocket_Reactive Programming - Fatal编程技术网

Android应用程序Meteor后端的OpeningHandshakeException

Android应用程序Meteor后端的OpeningHandshakeException,android,meteor,websocket,reactive-programming,Android,Meteor,Websocket,Reactive Programming,我刚刚学习并使用简单的Meteor create hellometeor命令实现了我的第一个Meteor应用程序,然后使用它使localhost:3000端口处于活动状态 然后,我使用库按照以下代码连接到directwsurl: // create a new instance, where mMeteor is a global var. mMeteor = new Meteor(this, "ws://180a3c0e.ngrok.io", new InMemoryDatab

我刚刚学习并使用简单的
Meteor create hellometeor
命令实现了我的第一个Meteor应用程序,然后使用它使
localhost:3000
端口处于活动状态

然后,我使用库按照以下代码连接到direct
ws
url:

    // create a new instance, where mMeteor is a global var.
    mMeteor = new Meteor(this, "ws://180a3c0e.ngrok.io", new InMemoryDatabase()); // "ws://180a3c0e.ngrok.io" is the temp. url after tunneling `localhost:3000`

    // register the callback that will handle events and receive messages
    mMeteor.addCallback(this); // as the activity implements MeteorCallback

    // establish the connection
    mMeteor.connect();
但每次我尝试运行这段代码时,我都会遇到以下错误,对于像我这样的新手,在过去6小时的谷歌搜索和阅读中,我没有发现任何建议或直接的解决方案:

W/System.err: java.lang.Exception: com.neovisionaries.ws.client.OpeningHandshakeException: The status code of the opening handshake response is not '101 Switching Protocols'. The status line is: HTTP/1.0 502 Bad Gateway
W/System.err:     at im.delight.android.ddp.Meteor$1.onError(Meteor.java:195)
W/System.err:     at com.neovisionaries.ws.client.ListenerManager.callOnError(ListenerManager.java:432)
W/System.err:     at com.neovisionaries.ws.client.ConnectThread.handleError(ConnectThread.java:50)
W/System.err:     at com.neovisionaries.ws.client.ConnectThread.run(ConnectThread.java:41)
W/System.err: Caused by: com.neovisionaries.ws.client.OpeningHandshakeException: The status code of the opening handshake response is not '101 Switching Protocols'. The status line is: HTTP/1.0 502 Bad Gateway
W/System.err:     at com.neovisionaries.ws.client.HandshakeReader.validateStatusLine(HandshakeReader.java:232)
W/System.err:     at com.neovisionaries.ws.client.HandshakeReader.readHandshake(HandshakeReader.java:54)
W/System.err:     at com.neovisionaries.ws.client.WebSocket.readHandshake(WebSocket.java:3113)
W/System.err:     at com.neovisionaries.ws.client.WebSocket.shakeHands(WebSocket.java:2992)
W/System.err:     at com.neovisionaries.ws.client.WebSocket.connect(WebSocket.java:2034)
W/System.err:     at com.neovisionaries.ws.client.ConnectThread.run(ConnectThread.java:37)
可能是我在Meteor服务器端缺少了一个非常常见的东西,因为除了启动项目之外,我没有在其中编写任何代码。
请在这方面启发我。

TIA.

我应该被钉死在十字架上,因为我不知道Meteor在
ws://…/websocket
url上有它的websocket连接

我刚刚在上一个URL的末尾添加了
/websocket
,一切都很顺利