Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TypeScript SDK] Fix websocket port #7637

Merged
merged 1 commit into from
Jan 25, 2023
Merged

[TypeScript SDK] Fix websocket port #7637

merged 1 commit into from
Jan 25, 2023

Conversation

666lcz
Copy link
Contributor

@666lcz 666lcz commented Jan 24, 2023

closes #7546

@vercel
Copy link

vercel bot commented Jan 24, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
explorer ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Jan 25, 2023 at 6:49AM (UTC)
frenemies ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Jan 25, 2023 at 6:49AM (UTC)
wallet-adapter ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Jan 25, 2023 at 6:49AM (UTC)
1 Ignored Deployment
Name Status Preview Comments Updated
explorer-storybook ⬜️ Ignored (Inspect) Jan 25, 2023 at 6:49AM (UTC)

@666lcz 666lcz marked this pull request as ready for review January 25, 2023 06:47
@vercel vercel bot temporarily deployed to Preview – frenemies January 25, 2023 06:47 Inactive
@666lcz 666lcz requested a review from gegaowp January 25, 2023 06:47
@666lcz 666lcz enabled auto-merge (squash) January 25, 2023 06:48
@vercel vercel bot temporarily deployed to Preview – wallet-adapter January 25, 2023 06:49 Inactive
Copy link
Contributor

@patrickkuo patrickkuo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@666lcz 666lcz merged commit 01458ff into main Jan 25, 2023
@666lcz 666lcz deleted the chris-fix-port branch January 25, 2023 11:52
@@ -13,7 +13,14 @@ import { Client as WsRpcClient } from 'rpc-websockets';
export const getWebsocketUrl = (httpUrl: string, port?: number): string => {
const url = new URL(httpUrl);
url.protocol = url.protocol.replace('http', 'ws');
url.port = (port ?? 9001).toString();
if (!url.port) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

URL ignores the default ports, for example doing something like

const url = new URL('http://example.com:80')
console.log(url.port); // ''

port will be empty same for https. So this will always throw if we use default port without passing the port parameter.

I don't think we should throw errors if port is not set. If not set it will mean the default port for the scheme (http/ws -> 80, https/wss -> 443)

pchrysochoidis added a commit that referenced this pull request Jan 25, 2023
williampsmith pushed a commit that referenced this pull request Feb 3, 2023
williampsmith pushed a commit that referenced this pull request Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TS SDK WS Client Hardcodes Port To 9001
3 participants