Skip to content

Commit

Permalink
fix: fix issue with connection id in debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
thaaddeus committed Aug 16, 2024
1 parent 9238492 commit 50b9262
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/realtimefeeds/realtimefeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export abstract class RealTimeFeedBase implements RealTimeFeedIterable {
private readonly _filters: Filter<string>[]
private _receivedMessagesCount = 0
private _ws?: WebSocket
private _connectionId = connectionCounter++
private _connectionId = -1
private _wsClientOptions: WebSocket.ClientOptions | ClientRequestArgs
protected readonly originHeader: string | undefined = undefined

Expand Down Expand Up @@ -73,6 +73,7 @@ export abstract class RealTimeFeedBase implements RealTimeFeedIterable {

while (true) {
try {
this._connectionId = connectionCounter++
const subscribeMessages = this.mapToSubscribeMessages(this._filters)
const finalWssUrl = await this.getWebSocketUrl()

Expand Down Expand Up @@ -294,7 +295,7 @@ export abstract class RealTimeFeedBase implements RealTimeFeedIterable {
}
}

this.debug('(connection id: %d) estabilished connection', this._connectionId)
this.debug('(connection id: %d) established connection', this._connectionId)

//wait before fetching snapshots until we're sure we've got proper connection estabilished (received some messages)
while (this._receivedMessagesCount < symbolsCount * 2) {
Expand Down

0 comments on commit 50b9262

Please sign in to comment.