无法连接到深层

时间:2017-02-18 18:36:56

标签: javascript connect deepstream.io

我是deepstream.io的新用户,我正试图从下面的深层网站运行该示例

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

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

http://localhost:6020/deepstream

没有任何反应

2 个答案:

答案 0 :(得分:0)

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>

答案 1 :(得分:0)

deepstream是一个websocket服务器-需要使用Deepstream客户端进行访问(请参见上面的答案)。将URL键入浏览器(或使用其他HTTP通讯请求)将无济于事。