@@ -373,17 +373,17 @@ export class WebSocketTransport<
373373 // This is because some providers handle subscriptions on the URLs and not through messages.
374374 // Subclasses may also implement alternate URL handling logic,
375375 // eg: toggling through multiple possible URLs in case of failure.
376- const url = await this . config . url ( context , subscriptions . desired , {
376+ const urlFromConfig = await this . config . url ( context , subscriptions . desired , {
377377 streamHandlerInvocationsWithNoConnection : this . streamHandlerInvocationsWithNoConnection ,
378378 } )
379- const urlChanged = this . currentUrl !== url
379+ const urlChanged = this . currentUrl !== urlFromConfig
380380
381381 // Check if we should close the current connection
382382 if ( ! connectionClosed && ( urlChanged || connectionUnresponsive ) ) {
383383 if ( urlChanged ) {
384384 censorLogs ( ( ) =>
385385 logger . debug (
386- `Websocket url has changed from ${ this . currentUrl } to ${ url } , closing connection...` ,
386+ `Websocket url has changed from ${ this . currentUrl } to ${ urlFromConfig } , closing connection...` ,
387387 ) ,
388388 )
389389 } else {
@@ -422,7 +422,7 @@ export class WebSocketTransport<
422422 logger . debug ( 'No established connection and new subscriptions available, connecting to WS' )
423423 const options =
424424 this . config . options && ( await this . config . options ( context , subscriptions . desired ) )
425- this . currentUrl = url
425+ this . currentUrl = urlFromConfig
426426 // Need to write this now, otherwise there could be messages sent with values before the open handler finishes
427427 this . providerDataStreamEstablished = Date . now ( )
428428
@@ -433,7 +433,7 @@ export class WebSocketTransport<
433433 subscriptions . new = subscriptions . desired
434434
435435 // Connect to the provider
436- this . wsConnection = await this . establishWsConnection ( context , url , options )
436+ this . wsConnection = await this . establishWsConnection ( context , urlFromConfig , options )
437437
438438 // Now that we successfully opened the connection, we can reset the variables
439439 connectionClosed = false
0 commit comments