【问题标题】:How do I find the wss URL for a meteor-deployed app?如何找到流星部署的应用程序的 wss URL?
【发布时间】:2015-11-12 00:53:34
【问题描述】:

我正在尝试通过 DDP 连接到我的流星部署网站 http://testsock.meteor.comThis other answer 非常有帮助,但我无法找到我的 URL,根据该答案应该具有以下结构:

ws://ddp--xxxx-{主机名}.meteor.com

你是怎么知道的?

我的meteor.js文件是:

if (Meteor.isClient) {
    }

    if (Meteor.isServer) {
      Meteor.startup(function () {
        // code to run on server at startup
      });

      Meteor.methods({
        test: function(){
          return 5;
        }
      });
    }

我使用pyddp,我的python文件ddp到我的网站是:

    import ddp
    import time
    import sys

    client = ddp.ConcurrentDDPClient('wss://testsock.meteor.com:443/websocket')
    client.start()

    while True:
        try:
            time.sleep(1)
            future = client.call('test')
            result_message = future.get()
            if result_message.has_result():
                print 'Result:', result_message.result
            if result_message.has_error():
                print 'Error:', result_message.error

        except KeyboardInterrupt:
            sys.exit()
            client.stop()
            client.join()
            break

【问题讨论】:

  • 我一直使用wss://myapp.meteor.com:443/websocket 连接到meteor.com 上部署的应用程序。你试过了吗?
  • 感谢您的回复!但不幸的是“找不到记录器“asynico”的处理程序”:(
  • 我认为它与ddp连接没有任何关系。您可能应该共享相关代码,最好是使问题可重现。
  • 啊,是的,我刚刚发现!现在不确定代码有什么问题,但在调试时,我发现它确实可以通过 ddp 连接。谢谢!!
  • 您使用的是我指定的 URL 架构还是其他 URL?

标签: meteor websocket ddp


【解决方案1】:

连接到部署到meteor.com 的应用时,您可以使用以下URL 方案:

wss://myapp.meteor.com:443/websocket

wss表示加密的WebSocket协议URI方案,运行在443端口。

【讨论】:

    猜你喜欢
    • 2018-05-05
    • 2012-05-28
    • 2015-08-16
    • 1970-01-01
    • 2013-02-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多