node-ddp-client icon indicating copy to clipboard operation
node-ddp-client copied to clipboard

Provide an example for "DDP Client for browsers"

Open bluepuma77 opened this issue 9 years ago • 0 comments

Can you describe the steps required to use the "DDP Client for browsers" in a HTML file?

<html>
  <head>
    <script src="???"></script>
    <script>

      var ddpclient = new DDPClient({
        host : "localhost",
        port : 3000,
        ssl  : false,
        autoReconnect : true,
        autoReconnectTimer : 500,
        maintainCollections : true,
        ddpVersion : '1',
        socketConstructor: WebSocket
      });

      ddpclient.subscribe(...);

      ddpclient.on('message', function (msg) {
        console.log("ddp message: " + msg);
      });

    </script>
  </head>
  <body>
    <p>Check the console log for DDP messages</p>
  </body>
</html>

bluepuma77 avatar Feb 25 '16 21:02 bluepuma77