Skip to content

use websockets #1

@ghost

Description

var WebSocket = require('ws');
var ws = new WebSocket('wss://n.block.io/');

ws.on('open', function open() {

  ws.on('message', function(data, flags) {
    // all messages filtered here. 
    console.log('data:    ', data)
    console.log('flags:    ', flags)

    // flags.binary will be set if a binary data is received.
    // flags.masked will be set if the data was masked.
  });


  function setWatch(address){
    console.log
    ws.send(JSON.stringify({
      "network": "BTC",
      "type": "address",
      "address": address
      }));
    };

  setWatch('xxx');

});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions