bennycode/coinbase-pro-node

Websocket example implementation needs to be updated?

kenchambers opened this issue · 2 comments

I'm having trouble getting the websocket implementation to work. I am getting this error when I connect using the example:

RWS> connect { url: 'wss://ws-feed-public.sandbox.pro.coinbase.com', protocols: [] }
RWS> addListeners
RWS> timeout event
RWS> error event TIMEOUT
RWS> removeListeners
RWS> exec error listeners
RWS> connect 3
RWS> removeListeners
RWS> next delay 1000
RWS> connect { url: 'wss://ws-feed-public.sandbox.pro.coinbase.com', protocols: [] }
RWS> addListeners
RWS> timeout event
RWS> error event TIMEOUT
RWS> removeListeners
RWS> exec error listeners
RWS> connect 4
RWS> removeListeners
RWS> next delay 1000
RWS> connect { url: 'wss://ws-feed-public.sandbox.pro.coinbase.com', protocols: [] }
RWS> addListeners

steps to reproduce:

  1. clone this repo
  2. yarn install
  3. run npx ts-node ./src/demo/websocket-ticker.ts

It might be I am missing a big step , or misunderstanding how to use it. but an explanation would be super helpful. thank you.

Hi @kenchambers, the command yarn demo:websocket:ticker is working fine. Can you please verify the following on your end?

  1. You have a .env file in the root of your cloned repository
  2. You have the following env variables set in this file: COINBASE_PRO_SANDBOX_API_KEY, COINBASE_PRO_SANDBOX_API_SECRET & COINBASE_PRO_SANDBOX_PASSPHRASE (you can get them from here: https://public.sandbox.pro.coinbase.com/profile/api)
  3. You are running yarn demo:websocket:ticker from the root of your cloned repository

Best,
Benny

That worked thank you!

I was missing .env and running wrong command :P