Skip to content

Commit

Permalink
rename options.useSSL -> options.secure on Client. #80
Browse files Browse the repository at this point in the history
  • Loading branch information
endel committed May 5, 2023
1 parent bde0b32 commit a5b58b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "colyseus.js",
"version": "0.15.3",
"version": "0.15.4",
"description": "Colyseus Multiplayer SDK for JavaScript/TypeScript",
"author": "Endel Dreyer",
"license": "MIT",
Expand Down
12 changes: 6 additions & 6 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const DEFAULT_ENDPOINT = (typeof (window) !== "undefined" && typeof (window?.lo
export interface EndpointSettings {
hostname: string,
port: number,
useSSL: boolean,
secure: boolean,
}

export class Client {
Expand All @@ -33,13 +33,13 @@ export class Client {
constructor(settings: string | EndpointSettings = DEFAULT_ENDPOINT) {
if (typeof (settings) === "string") {
const url = new URL(settings);
const useSSL = (url.protocol === "https:" || url.protocol === "wss:");
const port = Number(url.port || (useSSL ? 443 : 80));
const secure = (url.protocol === "https:" || url.protocol === "wss:");
const port = Number(url.port || (secure ? 443 : 80));

this.settings = {
hostname: url.hostname,
port,
useSSL
secure
};

} else {
Expand Down Expand Up @@ -185,7 +185,7 @@ export class Client {
params.push(`${name}=${options[name]}`);
}

let endpoint = (this.settings.useSSL)
let endpoint = (this.settings.secure)
? "wss://"
: "ws://"

Expand All @@ -200,7 +200,7 @@ export class Client {
}

protected getHttpEndpoint(segments: string) {
return `${(this.settings.useSSL) ? "https" : "http"}://${this.settings.hostname}${this.getEndpointPort()}/matchmake/${segments}`;
return `${(this.settings.secure) ? "https" : "http"}://${this.settings.hostname}${this.getEndpointPort()}/matchmake/${segments}`;
}

protected getEndpointPort() {
Expand Down

0 comments on commit a5b58b2

Please sign in to comment.