Support async transformWsUrl returning a Promise<string>#2042
Draft
Support async transformWsUrl returning a Promise<string>#2042
transformWsUrl returning a Promise<string>#2042Conversation
Co-authored-by: robertsLando <11502495+robertsLando@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix TransformUrl function to return resolved signed URL
Support async Mar 6, 2026
transformWsUrl returning a Promise<string>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
transformWsUrlonly supported synchronous functions. Returning aPromise<string>(e.g. for async URL signing) caused the client to connect with a stringified[object Promise]URL, resulting in endless reconnect loops.Changes
client.ts: UpdatedtransformWsUrltype to() => string | Promise<string>connect/ws.ts(Node.js): WhentransformWsUrlreturns a Promise, a deferredDuplexstream is returned immediately while buffering writes; once the URL resolves the real WebSocket is created and the buffer is flushedconnect/ws.ts(Browser):createBrowserWebSocketpropagates the Promise;browserStreamBuildercreates aBufferedDuplexwith a placeholder socket and wires up the real socket post-resolutionconnect/ali.ts/connect/wx.ts: Same pattern —connectSocketis deferred until the URL Promise resolvestest/node/websocket_client.ts: Added test covering asynctransformWsUrlUsage
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
localhost_fake/opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node --heap-prof-interval=524288 --cpu-prof-interval=1000 --test-coverage-functions=0 --test-concurrency=4 --inspect-publish-uid=stderr,http --inspect-port=127.0.0.1:9229 --report-signal=SIGUSR2 --test-coverage-lines=0 --test-isolation=process --tls-cipher-list=TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA(dns block)mqtt/home/REDACTED/work/_temp/ghcca-node/node/bin/node node -r esbuild-register --test-concurrency 1 test/node/websocket_client.ts(dns block)/opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node --heap-prof-interval=524288 --cpu-prof-interval=1000 --test-coverage-functions=0 --test-concurrency=4 --inspect-publish-uid=stderr,http --inspect-port=127.0.0.1:9229 --report-signal=SIGUSR2 --test-coverage-lines=0 --test-isolation=process --tls-cipher-list=TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA(dns block)/home/REDACTED/work/_temp/ghcca-node/node/bin/node node -r esbuild-register --test-concurrency 1 test/node/websocket_client.ts r bin/sh(dns block)this_hostname_should_not_exist/home/REDACTED/work/_temp/ghcca-node/node/bin/node node -r esbuild-register --test-concurrency 1 test/node/websocket_client.ts(dns block)/opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node --heap-prof-interval=524288 --cpu-prof-interval=1000 --test-coverage-functions=0 --test-concurrency=4 --inspect-publish-uid=stderr,http --inspect-port=127.0.0.1:9229 --report-signal=SIGUSR2 --test-coverage-lines=0 --test-isolation=process --tls-cipher-list=TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA(dns block)/home/REDACTED/work/_temp/ghcca-node/node/bin/node node -r esbuild-register --test-concurrency 1 test/node/websocket_client.ts r bin/sh(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.