Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/protocols/web/WebSocketAcceptor.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type http from "http";
import { sleep_for } from "tstl";
import type WebSocket from "ws";
import WebSocket from "ws";

import { Invoke } from "../../components/Invoke";
import { AcceptorBase } from "../internal/AcceptorBase";
Expand Down Expand Up @@ -303,5 +303,5 @@ export namespace WebSocketAcceptor {
/**
* Current state of the {@link WebSocketAcceptor}.
*/
export import State = AcceptorBase.State;
export type State = AcceptorBase.State;
}
2 changes: 1 addition & 1 deletion src/protocols/web/WebSocketConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ export namespace WebSocketConnector {
/**
* Current state of the {@link WebSocketConnector}.
*/
export import State = ConnectorBase.State;
export type State = ConnectorBase.State;

/**
* Connection options for the {@link WebSocketConnector.connect}.
Expand Down
2 changes: 1 addition & 1 deletion src/protocols/web/WebSocketServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
this.options_ = !!key && !!cert ? { key, cert } : null;

// INITIALIZE STATUS & PROTOCOL
this.state_ = WebSocketServer.State.NONE;

Check failure on line 97 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / Browser

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 97 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / NodeJS

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 97 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / NodeJS

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 97 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / Browser

Property 'State' does not exist on type 'typeof WebSocketServer'.
this.server_ = null;
this.protocol_ = null;
}
Expand Down Expand Up @@ -125,20 +125,20 @@
// PRELIMINARIES
//----
// POSSIBLE TO OPEN?
if (this.state_ === WebSocketServer.State.OPEN)

Check failure on line 128 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / Browser

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 128 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / NodeJS

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 128 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / NodeJS

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 128 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / Browser

Property 'State' does not exist on type 'typeof WebSocketServer'.
throw new Error(
"Error on WebSocketServer.open(): it has already been opened.",
);
else if (this.state_ === WebSocketServer.State.OPENING)

Check failure on line 132 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / Browser

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 132 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / NodeJS

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 132 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / NodeJS

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 132 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / Browser

Property 'State' does not exist on type 'typeof WebSocketServer'.
throw new Error(
"Error on WebSocketServer.open(): it's on opening, wait for a second.",
);
else if (this.state_ === WebSocketServer.State.CLOSING)

Check failure on line 136 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / Browser

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 136 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / NodeJS

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 136 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / NodeJS

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 136 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / Browser

Property 'State' does not exist on type 'typeof WebSocketServer'.
throw new Error("Error on WebSocketServer.open(): it's on closing.");
// DO OPEN
else if (
this.server_ === null ||
this.state_ === WebSocketServer.State.CLOSED

Check failure on line 141 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / Browser

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 141 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / NodeJS

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 141 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / NodeJS

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 141 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / Browser

Property 'State' does not exist on type 'typeof WebSocketServer'.
)
this.server_ =
this.options_ !== null
Expand All @@ -149,7 +149,7 @@
});

// SET STATE
this.state_ = WebSocketServer.State.OPENING;

Check failure on line 152 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / Browser

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 152 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / NodeJS

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 152 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / NodeJS

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 152 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / Browser

Property 'State' does not exist on type 'typeof WebSocketServer'.

//----
// OPEN SERVER
Expand Down Expand Up @@ -187,15 +187,15 @@
*/
public async close(): Promise<void> {
// VALIDATION
if (this.state_ !== WebSocketServer.State.OPEN)

Check failure on line 190 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / Browser

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 190 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / NodeJS

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 190 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / NodeJS

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 190 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / Browser

Property 'State' does not exist on type 'typeof WebSocketServer'.
throw new Error(
"Error on WebSocketServer.close(): server is not opened.",
);

// DO CLOSE
this.state_ = WebSocketServer.State.CLOSING;

Check failure on line 196 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / Browser

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 196 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / NodeJS

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 196 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / NodeJS

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 196 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / Browser

Property 'State' does not exist on type 'typeof WebSocketServer'.
await this._Close();
this.state_ = WebSocketServer.State.CLOSED;

Check failure on line 198 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / Browser

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 198 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / NodeJS

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 198 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / NodeJS

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 198 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / Browser

Property 'State' does not exist on type 'typeof WebSocketServer'.
}

/**
Expand All @@ -209,7 +209,7 @@
return new Promise((resolve, reject) => {
// PREPARE RETURNS
server.on("listening", () => {
setState(WebSocketServer.State.OPEN);

Check failure on line 212 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / Browser

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 212 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / NodeJS

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 212 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / NodeJS

Property 'State' does not exist on type 'typeof WebSocketServer'.

Check failure on line 212 in src/protocols/web/WebSocketServer.ts

View workflow job for this annotation

GitHub Actions / Browser

Property 'State' does not exist on type 'typeof WebSocketServer'.
server.on("error", () => {});
resolve();
});
Expand Down Expand Up @@ -264,5 +264,5 @@
/**
* Current state of the {@link WebSocketServer}.
*/
export import State = IServer.State;
export type State = IServer.State;
}
2 changes: 1 addition & 1 deletion src/protocols/workers/SharedWorkerAcceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,5 +201,5 @@ export namespace SharedWorkerAcceptor {
/**
* Current state of the {@link SharedWorkerAcceptor}.
*/
export import State = AcceptorBase.State;
export type State = AcceptorBase.State;
}
2 changes: 1 addition & 1 deletion src/protocols/workers/SharedWorkerConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export namespace SharedWorkerConnector {
/**
* Current state of the {@link SharedWorkerConnector}.
*/
export import State = ConnectorBase.State;
export type State = ConnectorBase.State;

/**
* Connection options for the {@link SharedWorkerConnector.connect}.
Expand Down
2 changes: 1 addition & 1 deletion src/protocols/workers/SharedWorkerServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export namespace SharedWorkerServer {
/**
* Current state of the {@link SharedWorkerServer}.
*/
export import State = IServer.State;
export type State = IServer.State;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/protocols/workers/WorkerConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ export namespace WorkerConnector {
/**
* Current state of the {@link WorkerConnector}.
*/
export import State = ConnectorBase.State;
export type State = ConnectorBase.State;

/**
* Connection options for the {@link WorkerConnector.connect}.
Expand Down
2 changes: 1 addition & 1 deletion src/protocols/workers/WorkerServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ export namespace WorkerServer {
/**
* Current state of the {@link WorkerServer}.
*/
export import State = IServer.State;
export type State = IServer.State;
}

//----
Expand Down