Skip to content

Commit c06a9a3

Browse files
remove determineUrlChanges as it is not needed
1 parent 930f6ac commit c06a9a3

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

src/transports/websocket.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,10 @@ 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 { urlChanged, url } = await this.determineUrlChange(context, subscriptions)
376+
const url = await this.config.url(context, subscriptions.desired, {
377+
streamHandlerInvocationsWithNoConnection: this.streamHandlerInvocationsWithNoConnection,
378+
})
379+
const urlChanged = this.currentUrl !== url
377380

378381
// Check if we should close the current connection
379382
if (!connectionClosed && (urlChanged || connectionUnresponsive)) {
@@ -473,17 +476,6 @@ export class WebSocketTransport<
473476
return
474477
}
475478

476-
async determineUrlChange(
477-
context: EndpointContext<T>,
478-
subscriptions: SubscriptionDeltas<TypeFromDefinition<T['Parameters']>>,
479-
): Promise<{ urlChanged: boolean; url: string }> {
480-
const url = await this.config.url(context, subscriptions.desired, {
481-
streamHandlerInvocationsWithNoConnection: this.streamHandlerInvocationsWithNoConnection,
482-
})
483-
const urlChanged = this.currentUrl !== url
484-
return { urlChanged, url }
485-
}
486-
487479
private rejectionHandler<E>(
488480
rejectionFn: (reason?: unknown) => void,
489481
handler: (event: E) => Promise<void>,

0 commit comments

Comments
 (0)