SHARE
TWEET

Untitled

a guest Jun 20th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const CoinbasePro = require('coinbase-pro');
  2. var coinbaseWs = '';
  3.  
  4. function connect() {
  5.     coinbaseWs = new CoinbasePro.WebsocketClient(
  6.         ['BTC-USD'],
  7.         'wss://ws-feed.pro.coinbase.com',
  8.         {
  9.             key: 'xxxx',
  10.             secret: 'xxxx',
  11.             passphrase: 'xxxx',
  12.         },
  13.         { channels: ['matches'] }
  14.     );  
  15.  
  16.     coinbaseWs.on('message', async data => {
  17.         console.log(data)  
  18.     });
  19.  
  20.     coinbaseWs.on('error', err => {
  21.       console.error("Connection with Coinbase websocket failed with error: " + err);
  22.       console.log("Error stack trace: " + err.stack);
  23.     });
  24.  
  25.     coinbaseWs.on('close', () => {
  26.       console.error("Connection with Coinbase websocket closed!");
  27.     });
  28. }
  29.  
  30. connect();
  31.      
  32. Error: read ECONNRESET
  33. File "internal/stream_base_commons.js", line 167, in TLSWrap.onStreamRead
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