@fuman/net 0.0.9 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.cts +1 -0
- package/index.d.ts +1 -0
- package/package.json +3 -3
- package/websocket-server.d.cts +16 -0
- package/websocket-server.d.ts +16 -0
- package/websocket.d.cts +5 -1
- package/websocket.d.ts +5 -1
package/index.d.cts
CHANGED
package/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fuman/net",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.11",
|
|
5
5
|
"description": "experimental network abstractions",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@fuman/io": "^0.0.
|
|
10
|
-
"@fuman/utils": "^0.0.
|
|
9
|
+
"@fuman/io": "^0.0.11",
|
|
10
|
+
"@fuman/utils": "^0.0.11"
|
|
11
11
|
},
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IConnection, TcpEndpoint } from './types.js';
|
|
2
|
+
import { IWebSocketConnectionFramed } from './websocket.js';
|
|
3
|
+
/** a connection to a WebSocket server (not to be confused with client-side connection!) */
|
|
4
|
+
export interface IWebSocketServerConnection extends IConnection<TcpEndpoint> {
|
|
5
|
+
/** headers from the handshake request */
|
|
6
|
+
readonly headers: Headers;
|
|
7
|
+
/** URL of the handshake request */
|
|
8
|
+
readonly url: string;
|
|
9
|
+
}
|
|
10
|
+
/** a framed connection to a WebSocket server (not to be confused with client-side connection!) */
|
|
11
|
+
export interface IWebSocketServerConnectionFramed extends IWebSocketConnectionFramed {
|
|
12
|
+
/** headers from the handshake request */
|
|
13
|
+
readonly headers: Headers;
|
|
14
|
+
/** URL of the handshake request */
|
|
15
|
+
readonly url: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IConnection, TcpEndpoint } from './types.js';
|
|
2
|
+
import { IWebSocketConnectionFramed } from './websocket.js';
|
|
3
|
+
/** a connection to a WebSocket server (not to be confused with client-side connection!) */
|
|
4
|
+
export interface IWebSocketServerConnection extends IConnection<TcpEndpoint> {
|
|
5
|
+
/** headers from the handshake request */
|
|
6
|
+
readonly headers: Headers;
|
|
7
|
+
/** URL of the handshake request */
|
|
8
|
+
readonly url: string;
|
|
9
|
+
}
|
|
10
|
+
/** a framed connection to a WebSocket server (not to be confused with client-side connection!) */
|
|
11
|
+
export interface IWebSocketServerConnectionFramed extends IWebSocketConnectionFramed {
|
|
12
|
+
/** headers from the handshake request */
|
|
13
|
+
readonly headers: Headers;
|
|
14
|
+
/** URL of the handshake request */
|
|
15
|
+
readonly url: string;
|
|
16
|
+
}
|
package/websocket.d.cts
CHANGED
|
@@ -24,7 +24,11 @@ export declare class WebSocketConnection extends WebSocketConnectionBase impleme
|
|
|
24
24
|
read(into: Uint8Array): Promise<number>;
|
|
25
25
|
write(bytes: Uint8Array): Promise<void>;
|
|
26
26
|
}
|
|
27
|
-
export
|
|
27
|
+
export interface IWebSocketConnectionFramed extends IClosable {
|
|
28
|
+
readFrame: () => Promise<Uint8Array | string>;
|
|
29
|
+
writeFrame: (frame: Uint8Array | string) => Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
export declare class WebSocketConnectionFramed extends WebSocketConnectionBase implements IWebSocketConnectionFramed {
|
|
28
32
|
#private;
|
|
29
33
|
onMessage(event: MessageEvent): void;
|
|
30
34
|
readFrame(): Promise<Uint8Array | string>;
|
package/websocket.d.ts
CHANGED
|
@@ -24,7 +24,11 @@ export declare class WebSocketConnection extends WebSocketConnectionBase impleme
|
|
|
24
24
|
read(into: Uint8Array): Promise<number>;
|
|
25
25
|
write(bytes: Uint8Array): Promise<void>;
|
|
26
26
|
}
|
|
27
|
-
export
|
|
27
|
+
export interface IWebSocketConnectionFramed extends IClosable {
|
|
28
|
+
readFrame: () => Promise<Uint8Array | string>;
|
|
29
|
+
writeFrame: (frame: Uint8Array | string) => Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
export declare class WebSocketConnectionFramed extends WebSocketConnectionBase implements IWebSocketConnectionFramed {
|
|
28
32
|
#private;
|
|
29
33
|
onMessage(event: MessageEvent): void;
|
|
30
34
|
readFrame(): Promise<Uint8Array | string>;
|