Skip to content

Commit

Permalink
change client options & types
Browse files Browse the repository at this point in the history
  • Loading branch information
JadlionHD committed Jun 23, 2023
1 parent 692a54a commit 2c61df7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/structures/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ class Client extends EventEmitter {
this.config = Object.assign(
{
https: {
ip: "127.0.0.1",
port: 17091,
enable: true,
url: "127.0.0.1",
type2: false
},
ip: "127.0.0.1",
port: 17091,
enet: {
ip: "127.0.0.1",
port: 17091,
maxPeers: 1024,
useNewPacket: {
asClient: false
Expand All @@ -34,7 +36,7 @@ class Client extends EventEmitter {
options
);

this._client = new Native(this.config.ip, this.config.port) as ClientType;
this._client = new Native(this.config.enet.ip, this.config.enet.port) as ClientType;
}

public on(event: "connect", listener: (netID: number) => void): this;
Expand Down Expand Up @@ -94,7 +96,7 @@ class Client extends EventEmitter {
private startWeb() {
if (!this.config.https) return;
if (this.config.https.enable)
WebServer(this.config.ip, this.config.port, this.config.https.type2);
WebServer(this.config.https.ip, this.config.https.port, this.config.https.type2);
}

private handleEvent() {
Expand Down
6 changes: 4 additions & 2 deletions types/client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ export interface ClientType {
export interface ClientOptions {
/** Built-in https web server */
https?: {
ip?: string;
port?: number;
enable?: boolean;
url?: string;
type2?: boolean;
};
ip?: string;
port?: number;
enet?: {
ip?: string;
port?: number;
maxPeers?: number;
useNewPacket?: {
asClient?: boolean;
Expand Down

0 comments on commit 2c61df7

Please sign in to comment.