Skip to content

Commit deec831

Browse files
committed
To handle cases where the server was run on a custom port.
1 parent 8cdd26e commit deec831

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

netplayjs-client/src/matchmaking/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ export const DEFAULT_SERVER_URL = "https://netplayjs.varunramesh.net";
1616
function getWebSocketURL(serverURL: string): string {
1717
const url = new URL(serverURL);
1818
if (url.protocol === "http:") {
19-
return `ws://${url.hostname}/`;
19+
return `ws://${url.hostname}:${url.port}/`;
2020
} else if (url.protocol === "https:") {
21-
return `wss://${url.hostname}/`;
21+
return `wss://${url.hostname}:${url.port}/`;
2222
} else {
2323
throw new Error(`Unknown protocol: ${url.protocol}`);
2424
}

0 commit comments

Comments
 (0)