feat(v4.0.0-beta.5): BREAKING CHANGE: rename "error" event to "exception" to avoid unhandled exceptions
This commit is contained in:
@@ -91,7 +91,7 @@ function setWsClientEventListeners(
|
||||
websocketClient.on('reconnected', (data) => {
|
||||
console.log(new Date(), accountRef, 'ws has reconnected ', data?.wsKey);
|
||||
});
|
||||
websocketClient.on('error', (data) => {
|
||||
websocketClient.on('exception', (data) => {
|
||||
console.error(new Date(), accountRef, 'ws exception: ', data);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -117,7 +117,7 @@ function setWsClientEventListeners(
|
||||
websocketClient.on('reconnected', (data) => {
|
||||
console.log(new Date(), accountRef, 'ws has reconnected ', data?.wsKey);
|
||||
});
|
||||
websocketClient.on('error', (data) => {
|
||||
websocketClient.on('exception', (data) => {
|
||||
console.error(new Date(), accountRef, 'ws exception: ', data);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -40,8 +40,8 @@ wsClient.on('reconnected', (data) => {
|
||||
wsClient.on('authenticated', (data) => {
|
||||
console.log('ws has authenticated ', data?.wsKey);
|
||||
});
|
||||
wsClient.on('error', (data) => {
|
||||
console.error('ws error: ', data);
|
||||
wsClient.on('exception', (data) => {
|
||||
console.error('ws exception: ', data);
|
||||
});
|
||||
|
||||
async function main() {
|
||||
|
||||
@@ -17,12 +17,8 @@ const logger = {
|
||||
* - Heartbeats/ping/pong/reconnects are all handled automatically.
|
||||
* If a connection drops, the client will clean it up, respawn a fresh connection and resubscribe for you.
|
||||
*/
|
||||
const wsClient = new WebsocketClient(
|
||||
{
|
||||
// demoTrading: true,
|
||||
},
|
||||
logger,
|
||||
);
|
||||
|
||||
const wsClient = new WebsocketClient();
|
||||
|
||||
wsClient.on('update', (data) => {
|
||||
console.log('raw message received ', JSON.stringify(data));
|
||||
@@ -40,9 +36,10 @@ wsClient.on('reconnect', ({ wsKey }) => {
|
||||
wsClient.on('reconnected', (data) => {
|
||||
console.log('ws has reconnected ', data?.wsKey);
|
||||
});
|
||||
// wsClient.on('error', (data) => {
|
||||
// console.error('ws exception: ', data);
|
||||
// });
|
||||
|
||||
wsClient.on('exception', (data) => {
|
||||
console.error('ws exception: ', data);
|
||||
});
|
||||
|
||||
/**
|
||||
* For public V5 topics, use the subscribeV5 method and include the API category this topic is for.
|
||||
|
||||
Reference in New Issue
Block a user