Websocket example implementation needs to be updated?
kenchambers opened this issue · 2 comments
kenchambers commented
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:
- clone this repo
- yarn install
- 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.
bennycode commented
Hi @kenchambers, the command yarn demo:websocket:ticker
is working fine. Can you please verify the following on your end?
- You have a
.env
file in the root of your cloned repository - 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) - You are running
yarn demo:websocket:ticker
from the root of your cloned repository
Best,
Benny
kenchambers commented
That worked thank you!
I was missing .env and running wrong command :P