SHARE
TWEET

Working websocket binance

a guest Mar 22nd, 2019 104 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var WebSocketClient = require('websocket').client;
  2.  
  3. var client = new WebSocketClient();
  4.  
  5. client.on('connectFailed', function(error) {
  6.     console.log('Connect Error: ' + error.toString());
  7. });
  8.  
  9. client.on('connect', function(connection) {
  10.     console.log('WebSocket Client Connected');
  11.     connection.on('error', function(error) {
  12.         console.log("Connection Error: " + error.toString());
  13.     });
  14.     connection.on('close', function() {
  15.         console.log('echo-protocol Connection Closed');
  16.     });
  17.     connection.on('message', function(message) {
  18.         console.log(message);
  19.     });
  20. });
  21.  
  22. client.connect('wss://stream.binance.com:9443/ws/bnbbtc@trade');
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top