Skip to content

Commit 3256667

Browse files
committed
Expose currently configured socket URL, improve error connect status messages
1 parent 1d5fbe4 commit 3256667

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/SocketBase.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ const ApiSocket = (userOptions: Options.APISocketOptions, WebSocketImpl: WebSock
268268
};
269269

270270
ws!.onerror = (event) => {
271-
logger.error('Connecting socket failed');
271+
logger.error('Connecting socket failed (network/system error, most likely the server is unreachable)');
272272
scheduleReconnect();
273273
};
274274
};
@@ -281,7 +281,7 @@ const ApiSocket = (userOptions: Options.APISocketOptions, WebSocketImpl: WebSock
281281
forceNoAutoConnect = false;
282282
return new Promise(
283283
(resolve, reject) => {
284-
logger.info('Starting socket connect');
284+
logger.info(`Starting socket connect to ${userOptions.url}`);
285285
connectInternal(resolve, reject, authenticationHandler, reconnectOnFailure);
286286
}
287287
);
@@ -458,6 +458,10 @@ const ApiSocket = (userOptions: Options.APISocketOptions, WebSocketImpl: WebSock
458458
return ws;
459459
},
460460

461+
get url() {
462+
return userOptions.url;
463+
},
464+
461465
...subscriptions.socket,
462466
...requests.socket,
463467
};

src/types/socket.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ export interface APISocket extends SocketRequestMethods, SocketSubscriptions {
2626
onSessionReset: SessionResetCallback | null;
2727
onDisconnected: DisconnectedCallback | null;
2828
readonly nativeSocket: WebSocket | null;
29+
readonly url: string;
2930
}

0 commit comments

Comments
 (0)