Skip to content

Commit

Permalink
chore(): readme updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagosiebler committed Sep 26, 2024
1 parent 66acfa3 commit df40588
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ Updated & performant JavaScript & Node.js SDK for the Coinbase REST APIs and Web
- Complete integration with all REST APIs and WebSockets.
- TypeScript support (with type declarations for most API requests & responses)
- Robust WebSocket integration with configurable connection heartbeats & automatic reconnect then resubscribe workflows.
- Browser-friendly HMAC signature mechanism.
- Automatically supports both ESM and CJS projects.
- Proxy support via axios integration.
- Active community support & collaboration in telegram: [Node.js Algo Traders](https://t.me/nodetraders).
Expand Down Expand Up @@ -231,6 +230,18 @@ const { WebsocketClient } = require('coinbase-api');

// public ws client, doesnt need any api keys to run
const client = new WebsocketClient();

// The WS Key (last parameter) dictates which WS feed this request goes to (aka if auth is required).
// As long as the WS feed doesn't require auth, you should be able to subscribe to channels without api credentials.
client.subscribe(
{
topic: 'status',
payload: {
product_ids: ['XRP-USD'],
},
},
'advTradeMarketData',
);
```

#### Private Websocket
Expand Down Expand Up @@ -373,7 +384,7 @@ See [WebsocketClient](./src/WebsocketClient.ts) for further information and make
Pass a custom logger which supports the log methods `trace`, `info` and `error`, or override methods from the default logger as desired.
```javascript
const { WebsocketClient, DefaultLogger } = require('kucoin-api');
const { WebsocketClient, DefaultLogger } = require('coinbase-api');

// E.g. customise logging for only the trace level:
const logger = {
Expand All @@ -384,13 +395,14 @@ const logger = {
if (
[
'Sending ping',
// 'Sending upstream ws message: ',
'Received pong',
'Sending upstream ws message: ',
'Received pong, clearing pong timer',
'Received ping, sending pong frame',
].includes(params[0])
) {
return;
}
console.log('trace', JSON.stringify(params, null, 2));
console.log('trace', params);
},
};

Expand Down

0 comments on commit df40588

Please sign in to comment.