【问题标题】:Unable to connect to deepstream无法连接到深流
【发布时间】:2017-02-18 18:36:55
【问题描述】:

我是 deepstream.io 的新用户,我正在尝试从以下 deepstream 站点运行示例

https://deepstream.io/tutorials/core/getting-started-quickstart/

但是在启动 deepstream 服务器后,当我尝试访问下面的 url 时

http://localhost:6020/deepstream

什么都没发生

【问题讨论】:

    标签: javascript connect deepstream.io


    【解决方案1】:

    要解决此问题,您需要将 index.html(或您命名的包含 deepstream 客户端连接的文件)托管到网络服务器。

    当您连接到网络服务器以访问 index.html 时,它将执行 javascript 以启动 deepstream 客户端,然后建立与运行在即默认端口 6020 上的 deepstream 服务器的连接

    希望这会有所帮助。

    【讨论】:

      【解决方案2】:
      Hi Im also a new user. Have you installed all the needed packages?
      For me it works and my Index.html looks like this:
      
      <!DOCTYPE html>
      <html>
        <head>
          <script src="https://cdnjs.cloudflare.com/ajax/libs/deepstream.io-client-js/2.1.1/deepstream.js"></script>
        </head>
        <body>
        <div id="app"></div>
          <input type="text" />
          <script type="text/javascript">
            var client = deepstream('localhost:6020').login();
            var record = client.record.getRecord('myname');
            var input = document.querySelector('input');
      
      
                console.log("helloooo");
                record.set('firstname', input.value);
            });
      
            record.subscribe('firstname', function(value) {
                input.value = value;
            });
      
          </script>
        </body>
      </html>
      

      【讨论】:

        【解决方案3】:

        deepstream 是一个 websocket 服务器 - 它需要使用 deepstream 客户端访问(参见上面的答案)。将 URL 键入浏览器(或使用其他 HTTP 通信方式请求它)不会执行任何操作。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2017-05-09
          • 1970-01-01
          • 2021-12-19
          • 1970-01-01
          • 1970-01-01
          • 2019-03-03
          相关资源
          最近更新 更多