uws-react-native 0.0.9 → 0.0.10
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/README.md +27 -7
- package/cpp/UwsReactNativeModule.h +77 -0
- package/cpp/app/TemplatedAppObject.h +28 -0
- package/cpp/app/WebSocketBehaviorImpl.h +48 -0
- package/cpp/app/WebSocketObject.h +64 -0
- package/lib/commonjs/_internal/native-modules/NativeUwsReactNative.js.map +1 -1
- package/lib/commonjs/modules/CompressOptions.js +89 -101
- package/lib/commonjs/modules/CompressOptions.js.map +1 -1
- package/lib/commonjs/types/WebSocketBehavior.js +6 -0
- package/lib/commonjs/types/WebSocketBehavior.js.map +1 -0
- package/lib/module/_internal/native-modules/NativeUwsReactNative.js.map +1 -1
- package/lib/module/modules/CompressOptions.js +85 -101
- package/lib/module/modules/CompressOptions.js.map +1 -1
- package/lib/module/types/WebSocketBehavior.js +4 -0
- package/lib/module/types/WebSocketBehavior.js.map +1 -0
- package/lib/typescript/commonjs/_internal/native-modules/NativeUwsReactNative.d.ts +76 -0
- package/lib/typescript/commonjs/_internal/native-modules/NativeUwsReactNative.d.ts.map +1 -1
- package/lib/typescript/commonjs/modules/CompressOptions.d.ts +81 -0
- package/lib/typescript/commonjs/modules/CompressOptions.d.ts.map +1 -1
- package/lib/typescript/commonjs/types/WebSocket.d.ts +42 -43
- package/lib/typescript/commonjs/types/WebSocket.d.ts.map +1 -1
- package/lib/typescript/commonjs/types/WebSocketBehavior.d.ts +101 -0
- package/lib/typescript/commonjs/types/WebSocketBehavior.d.ts.map +1 -0
- package/lib/typescript/module/_internal/native-modules/NativeUwsReactNative.d.ts +76 -0
- package/lib/typescript/module/_internal/native-modules/NativeUwsReactNative.d.ts.map +1 -1
- package/lib/typescript/module/modules/CompressOptions.d.ts +81 -0
- package/lib/typescript/module/modules/CompressOptions.d.ts.map +1 -1
- package/lib/typescript/module/types/WebSocket.d.ts +42 -43
- package/lib/typescript/module/types/WebSocket.d.ts.map +1 -1
- package/lib/typescript/module/types/WebSocketBehavior.d.ts +101 -0
- package/lib/typescript/module/types/WebSocketBehavior.d.ts.map +1 -0
- package/lib/typescript/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/_internal/native-modules/NativeUwsReactNative.ts +95 -0
- package/src/modules/CompressOptions.ts +101 -101
- package/src/types/TemplatedApp.ts +3 -3
- package/src/types/WebSocket.ts +59 -60
- package/src/types/WebSocketBehavior.ts +161 -0
- package/src/types/index.ts +1 -1
- package/lib/commonjs/types/WebSocketBehaviour.js +0 -139
- package/lib/commonjs/types/WebSocketBehaviour.js.map +0 -1
- package/lib/module/types/WebSocketBehaviour.js +0 -139
- package/lib/module/types/WebSocketBehaviour.js.map +0 -1
- package/lib/typescript/commonjs/types/WebSocketBehaviour.d.ts +0 -1
- package/lib/typescript/commonjs/types/WebSocketBehaviour.d.ts.map +0 -1
- package/lib/typescript/module/types/WebSocketBehaviour.d.ts +0 -1
- package/lib/typescript/module/types/WebSocketBehaviour.d.ts.map +0 -1
- package/src/types/WebSocketBehaviour.ts +0 -137
package/src/types/WebSocket.ts
CHANGED
|
@@ -6,23 +6,20 @@ import type {
|
|
|
6
6
|
* A WebSocket connection that is valid from open to close event.
|
|
7
7
|
* Read more about this in the user manual.
|
|
8
8
|
*/
|
|
9
|
-
export interface WebSocket
|
|
9
|
+
export interface WebSocket<UserData> {
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* Make sure you properly understand the concept of backpressure. Check the backpressure example file.
|
|
11
|
+
* Forcefully closes this WebSocket. Immediately calls the close handler.
|
|
12
|
+
* No WebSocket close message is sent.
|
|
14
13
|
*/
|
|
15
|
-
|
|
16
|
-
message: RecognizedString,
|
|
17
|
-
isBinary?: boolean,
|
|
18
|
-
compress?: boolean,
|
|
19
|
-
) : number,
|
|
14
|
+
close() : void,
|
|
20
15
|
|
|
21
16
|
/**
|
|
22
|
-
*
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
* See `HttpResponse.cork`.
|
|
18
|
+
* Takes a function in which the socket is corked (packing many sends into one single syscall/SSL block)
|
|
19
|
+
*/
|
|
20
|
+
cork(
|
|
21
|
+
cb: () => void,
|
|
22
|
+
) : WebSocket<UserData>,
|
|
26
23
|
|
|
27
24
|
/**
|
|
28
25
|
* Gracefully closes this WebSocket. Immediately calls the close handler.
|
|
@@ -34,31 +31,40 @@ export interface WebSocket/* <UserData> */ {
|
|
|
34
31
|
) : void,
|
|
35
32
|
|
|
36
33
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
34
|
+
* Returns the bytes buffered in backpressure. This is similar to the bufferedAmount property in the browser counterpart.
|
|
35
|
+
* Check backpressure example.
|
|
39
36
|
*/
|
|
40
|
-
|
|
37
|
+
getBufferedAmount() : number,
|
|
41
38
|
|
|
42
39
|
/**
|
|
43
|
-
*
|
|
40
|
+
* Returns the remote IP address. Note that the returned IP is binary, not text.
|
|
41
|
+
*
|
|
42
|
+
* IPv4 is 4 byte long and can be converted to text by printing every byte as a digit between 0 and 255.
|
|
43
|
+
* IPv6 is 16 byte long and can be converted to text in similar ways, but you typically print digits in HEX.
|
|
44
|
+
*
|
|
45
|
+
* See getRemoteAddressAsText() for a text version.
|
|
46
|
+
*/
|
|
47
|
+
getRemoteAddress() : ArrayBuffer,
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Returns the remote IP address as text.
|
|
44
51
|
*/
|
|
45
|
-
|
|
46
|
-
message?: RecognizedString,
|
|
47
|
-
) : number,
|
|
52
|
+
getRemoteAddressAsText() : string,
|
|
48
53
|
|
|
49
54
|
/**
|
|
50
|
-
*
|
|
55
|
+
* Returns the remote port number.
|
|
51
56
|
*/
|
|
52
|
-
|
|
53
|
-
topic: RecognizedString,
|
|
54
|
-
) : boolean,
|
|
57
|
+
getRemotePort() : number,
|
|
55
58
|
|
|
56
59
|
/**
|
|
57
|
-
*
|
|
60
|
+
* Returns a list of topics this websocket is subscribed to.
|
|
58
61
|
*/
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
getTopics() : string[],
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Returns the UserData object.
|
|
66
|
+
*/
|
|
67
|
+
getUserData() : UserData,
|
|
62
68
|
|
|
63
69
|
/**
|
|
64
70
|
* Returns whether this websocket is subscribed to topic.
|
|
@@ -68,9 +74,11 @@ export interface WebSocket/* <UserData> */ {
|
|
|
68
74
|
) : boolean,
|
|
69
75
|
|
|
70
76
|
/**
|
|
71
|
-
*
|
|
77
|
+
* Sends a ping control message. Returns sendStatus similar to WebSocket.send (regarding backpressure). This helper function correlates to WebSocket::send(message, uWS::OpCode::PING, ...) in C++.
|
|
72
78
|
*/
|
|
73
|
-
|
|
79
|
+
ping(
|
|
80
|
+
message?: RecognizedString,
|
|
81
|
+
) : number,
|
|
74
82
|
|
|
75
83
|
/**
|
|
76
84
|
* Publish a message under topic. Backpressure is managed according to maxBackpressure, closeOnBackpressureLimit settings.
|
|
@@ -84,38 +92,15 @@ export interface WebSocket/* <UserData> */ {
|
|
|
84
92
|
) : boolean,
|
|
85
93
|
|
|
86
94
|
/**
|
|
87
|
-
*
|
|
88
|
-
*/
|
|
89
|
-
cork(
|
|
90
|
-
cb: () => void,
|
|
91
|
-
) : WebSocket/* <UserData> */,
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Returns the remote IP address. Note that the returned IP is binary, not text.
|
|
95
|
-
*
|
|
96
|
-
* IPv4 is 4 byte long and can be converted to text by printing every byte as a digit between 0 and 255.
|
|
97
|
-
* IPv6 is 16 byte long and can be converted to text in similar ways, but you typically print digits in HEX.
|
|
95
|
+
* Sends a message. Returns 1 for success, 2 for dropped due to backpressure limit, and 0 for built up backpressure that will drain over time. You can check backpressure before or after sending by calling getBufferedAmount().
|
|
98
96
|
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* @experimental It's an experimental due to unstable of ArrayBuffer support from React Native.
|
|
97
|
+
* Make sure you properly understand the concept of backpressure. Check the backpressure example file.
|
|
102
98
|
*/
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
getRemoteAddressAsText() : /* ArrayBuffer */string,
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Returns the remote port number.
|
|
112
|
-
*/
|
|
113
|
-
getRemotePort() : number,
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Returns the UserData ~object~ string.
|
|
117
|
-
*/
|
|
118
|
-
getUserData() : /* UserData */string,
|
|
99
|
+
send(
|
|
100
|
+
message: RecognizedString,
|
|
101
|
+
isBinary?: boolean,
|
|
102
|
+
compress?: boolean,
|
|
103
|
+
) : number,
|
|
119
104
|
|
|
120
105
|
/**
|
|
121
106
|
* Sends the first fragment of a fragmented message. Use for sending large messages in chunks.
|
|
@@ -144,4 +129,18 @@ export interface WebSocket/* <UserData> */ {
|
|
|
144
129
|
message: RecognizedString,
|
|
145
130
|
compress?: boolean,
|
|
146
131
|
) : number,
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Subscribe to a topic.
|
|
135
|
+
*/
|
|
136
|
+
subscribe(
|
|
137
|
+
topic: RecognizedString,
|
|
138
|
+
) : boolean,
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Unsubscribe from a topic. Returns true on success, if the WebSocket was subscribed.
|
|
142
|
+
*/
|
|
143
|
+
unsubscribe(
|
|
144
|
+
topic: RecognizedString,
|
|
145
|
+
) : boolean,
|
|
147
146
|
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CompressOptions,
|
|
3
|
+
} from "../modules/CompressOptions"
|
|
4
|
+
|
|
5
|
+
import type {
|
|
6
|
+
HttpRequest,
|
|
7
|
+
} from "./HttpRequest"
|
|
8
|
+
|
|
9
|
+
import type {
|
|
10
|
+
HttpResponse,
|
|
11
|
+
} from "./HttpResponse"
|
|
12
|
+
|
|
13
|
+
import type {
|
|
14
|
+
WebSocket,
|
|
15
|
+
} from "./WebSocket"
|
|
16
|
+
|
|
17
|
+
import type {
|
|
18
|
+
us_socket_context_t,
|
|
19
|
+
} from "./us_socket_context_t"
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A structure holding settings and handlers for a WebSocket URL route handler.
|
|
23
|
+
*/
|
|
24
|
+
export interface WebSocketBehavior<UserData> {
|
|
25
|
+
/**
|
|
26
|
+
* Handler for close event, no matter if error, timeout or graceful close.
|
|
27
|
+
* You may not use WebSocket after this event.
|
|
28
|
+
* Do not send on this WebSocket from within here, it is closed.
|
|
29
|
+
*/
|
|
30
|
+
close?: (
|
|
31
|
+
ws: WebSocket<UserData>,
|
|
32
|
+
code: number,
|
|
33
|
+
message: ArrayBuffer,
|
|
34
|
+
) => void,
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Whether or not we should automatically close the socket when a message is dropped due to backpressure. Defaults to false.
|
|
38
|
+
*/
|
|
39
|
+
closeOnBackpressureLimit?: boolean,
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* What permessage-deflate compression to use. uWS.DISABLED, uWS.SHARED_COMPRESSOR or any of the uWS.DEDICATED_COMPRESSOR_xxxKB. Defaults to uWS.DISABLED.
|
|
43
|
+
*
|
|
44
|
+
* Combine any compressor with any decompressor using bitwise OR.
|
|
45
|
+
*/
|
|
46
|
+
compression?: CompressOptions,
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Handler for when WebSocket backpressure drains.
|
|
50
|
+
* Check `ws.getBufferedAmount()`.
|
|
51
|
+
* Use this to guide / drive your backpressure throttling.
|
|
52
|
+
*/
|
|
53
|
+
drain?: (
|
|
54
|
+
ws: WebSocket<UserData>,
|
|
55
|
+
) => void,
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Handler for a dropped WebSocket message.
|
|
59
|
+
* Messages can be dropped due to specified backpressure settings.
|
|
60
|
+
* Messages are given as ArrayBuffer no matter if they are binary or not.
|
|
61
|
+
* Given ArrayBuffer is valid during the lifetime of this callback
|
|
62
|
+
* (until first await or return) and will be neutered.
|
|
63
|
+
*/
|
|
64
|
+
dropped?: (
|
|
65
|
+
ws: WebSocket<UserData>,
|
|
66
|
+
message: ArrayBuffer,
|
|
67
|
+
isBinary: boolean,
|
|
68
|
+
) => void | Promise<void>,
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Maximum amount of seconds that may pass without sending or getting a message. Connection is closed if this timeout passes.
|
|
72
|
+
* Resolution (granularity) for timeouts are typically 4 seconds, rounded to closest.
|
|
73
|
+
*
|
|
74
|
+
* Disable by using 0. Defaults to 120.
|
|
75
|
+
*/
|
|
76
|
+
idleTimeout?: number,
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Maximum length of allowed backpressure per socket when publishing or sending messages.
|
|
80
|
+
* Slow receivers with too high backpressure will be skipped until they catch up or timeout.
|
|
81
|
+
*
|
|
82
|
+
* Defaults to 64 * 1024.
|
|
83
|
+
*/
|
|
84
|
+
maxBackpressure?: number,
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Maximum number of minutes a WebSocket may be connected before being closed by the server.
|
|
88
|
+
*
|
|
89
|
+
* 0 disables the feature. Valid values are 0 and 1-239.
|
|
90
|
+
*/
|
|
91
|
+
maxLifetime?: number,
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Maximum length of received message.
|
|
95
|
+
* If a client tries to send you a message larger than this, the connection is immediately closed.
|
|
96
|
+
*
|
|
97
|
+
* Defaults to 16 * 1024.
|
|
98
|
+
*/
|
|
99
|
+
maxPayloadLength?: number,
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Handler for a WebSocket message.
|
|
103
|
+
* Messages are given as ArrayBuffer no matter if they are binary or not.
|
|
104
|
+
*
|
|
105
|
+
* Given ArrayBuffer is valid during the lifetime of this callback (until first await or return) and will be neutered.
|
|
106
|
+
*/
|
|
107
|
+
message?: (
|
|
108
|
+
ws: WebSocket<UserData>,
|
|
109
|
+
message: ArrayBuffer,
|
|
110
|
+
isBinary: boolean,
|
|
111
|
+
) => void | Promise<void>,
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Handler for new WebSocket connection.
|
|
115
|
+
* WebSocket is valid from open to close, no errors.
|
|
116
|
+
*/
|
|
117
|
+
open?: (
|
|
118
|
+
ws: WebSocket<UserData>,
|
|
119
|
+
) => void | Promise<void>,
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Handler for received ping control message.
|
|
123
|
+
* You do not need to handle this, pong messages are automatically sent as per the standard.
|
|
124
|
+
*/
|
|
125
|
+
ping?: (
|
|
126
|
+
ws: WebSocket<UserData>,
|
|
127
|
+
message: ArrayBuffer,
|
|
128
|
+
) => void,
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Handler for received pong control message.
|
|
132
|
+
*/
|
|
133
|
+
pong?: (
|
|
134
|
+
ws: WebSocket<UserData>,
|
|
135
|
+
message: ArrayBuffer,
|
|
136
|
+
) => void,
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Whether or not we should automatically send pings to uphold a stable connection given whatever `idleTimeout`.
|
|
140
|
+
*/
|
|
141
|
+
sendPingsAutomatically?: boolean,
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Handler for subscription changes.
|
|
145
|
+
*/
|
|
146
|
+
subscription?: (
|
|
147
|
+
ws: WebSocket<UserData>,
|
|
148
|
+
topic: ArrayBuffer,
|
|
149
|
+
newCount: number,
|
|
150
|
+
oldCount: number,
|
|
151
|
+
) => void,
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Upgrade handler used to intercept HTTP upgrade requests and potentially upgrade to WebSocket.
|
|
155
|
+
*/
|
|
156
|
+
upgrade?: (
|
|
157
|
+
res: HttpResponse,
|
|
158
|
+
req: HttpRequest,
|
|
159
|
+
context: us_socket_context_t,
|
|
160
|
+
) => void | Promise<void>,
|
|
161
|
+
}
|
package/src/types/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type * from "./MultipartField"
|
|
|
6
6
|
export type * from "./RecognizedString"
|
|
7
7
|
export type * from "./TemplatedApp"
|
|
8
8
|
// export type * from "./WebSocket"
|
|
9
|
-
// export type * from "./
|
|
9
|
+
// export type * from "./WebSocketBehavior"
|
|
10
10
|
// export type * from "./us_listen_socket"
|
|
11
11
|
// export type * from "./us_socket"
|
|
12
12
|
// export type * from "./us_socket_context_t"
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
// import type {
|
|
2
|
-
// CompressOptions,
|
|
3
|
-
// } from "../modules/CompressOptions"
|
|
4
|
-
|
|
5
|
-
// import type {
|
|
6
|
-
// HttpRequest,
|
|
7
|
-
// } from "./HttpRequest"
|
|
8
|
-
|
|
9
|
-
// import type {
|
|
10
|
-
// HttpResponse,
|
|
11
|
-
// } from "./HttpResponse"
|
|
12
|
-
|
|
13
|
-
// import type {
|
|
14
|
-
// WebSocket,
|
|
15
|
-
// } from "./WebSocket"
|
|
16
|
-
|
|
17
|
-
// import type {
|
|
18
|
-
// us_socket_context_t,
|
|
19
|
-
// } from "./us_socket_context_t"
|
|
20
|
-
|
|
21
|
-
// /**
|
|
22
|
-
// * A structure holding settings and handlers for a WebSocket URL route handler.
|
|
23
|
-
// */
|
|
24
|
-
// export interface WebSocketBehavior/* <UserData> */ {
|
|
25
|
-
// /**
|
|
26
|
-
// * Maximum length of received message. If a client tries to send you a message larger than this, the connection is immediately closed. Defaults to 16 * 1024.
|
|
27
|
-
// */
|
|
28
|
-
// maxPayloadLength?: number,
|
|
29
|
-
|
|
30
|
-
// /**
|
|
31
|
-
// * Whether or not we should automatically close the socket when a message is dropped due to backpressure. Defaults to false.
|
|
32
|
-
// */
|
|
33
|
-
// closeOnBackpressureLimit?: boolean,
|
|
34
|
-
|
|
35
|
-
// /**
|
|
36
|
-
// * Maximum number of minutes a WebSocket may be connected before being closed by the server. 0 disables the feature. Valid values are 0 and 1-239.
|
|
37
|
-
// */
|
|
38
|
-
// maxLifetime?: number,
|
|
39
|
-
|
|
40
|
-
// /**
|
|
41
|
-
// * Maximum amount of seconds that may pass without sending or getting a message. Connection is closed if this timeout passes. Resolution (granularity) for timeouts are typically 4 seconds, rounded to closest.
|
|
42
|
-
// * Disable by using 0. Defaults to 120.
|
|
43
|
-
// */
|
|
44
|
-
// idleTimeout?: number,
|
|
45
|
-
|
|
46
|
-
// /**
|
|
47
|
-
// * What permessage-deflate compression to use. uWS.DISABLED, uWS.SHARED_COMPRESSOR or any of the uWS.DEDICATED_COMPRESSOR_xxxKB. Defaults to uWS.DISABLED.
|
|
48
|
-
// */
|
|
49
|
-
// compression?: CompressOptions,
|
|
50
|
-
|
|
51
|
-
// /**
|
|
52
|
-
// * Maximum length of allowed backpressure per socket when publishing or sending messages. Slow receivers with too high backpressure will be skipped until they catch up or timeout. Defaults to 64 * 1024.
|
|
53
|
-
// */
|
|
54
|
-
// maxBackpressure?: number,
|
|
55
|
-
|
|
56
|
-
// /**
|
|
57
|
-
// * Whether or not we should automatically send pings to uphold a stable connection given whatever idleTimeout.
|
|
58
|
-
// */
|
|
59
|
-
// sendPingsAutomatically?: boolean,
|
|
60
|
-
|
|
61
|
-
// /**
|
|
62
|
-
// * Upgrade handler used to intercept HTTP upgrade requests and potentially upgrade to WebSocket.
|
|
63
|
-
// * See UpgradeAsync and UpgradeSync example files.
|
|
64
|
-
// */
|
|
65
|
-
// upgrade?: (
|
|
66
|
-
// res: HttpResponse,
|
|
67
|
-
// req: HttpRequest,
|
|
68
|
-
// context: us_socket_context_t,
|
|
69
|
-
// ) => void | Promise<void>,
|
|
70
|
-
|
|
71
|
-
// /**
|
|
72
|
-
// * Handler for new WebSocket connection. WebSocket is valid from open to close, no errors.
|
|
73
|
-
// */
|
|
74
|
-
// open?: (
|
|
75
|
-
// ws: WebSocket/* <UserData> */,
|
|
76
|
-
// ) => void | Promise<void>,
|
|
77
|
-
|
|
78
|
-
// /**
|
|
79
|
-
// * Handler for a WebSocket message. Messages are given as ArrayBuffer no matter if they are binary or not. Given ArrayBuffer is valid during the lifetime of this callback (until first await or return) and will be neutered.
|
|
80
|
-
// */
|
|
81
|
-
// message?: (
|
|
82
|
-
// ws: WebSocket/* <UserData> */,
|
|
83
|
-
// message: ArrayBuffer,
|
|
84
|
-
// isBinary: boolean,
|
|
85
|
-
// ) => void | Promise<void>,
|
|
86
|
-
|
|
87
|
-
// /**
|
|
88
|
-
// * Handler for a dropped WebSocket message. Messages can be dropped due to specified backpressure settings. Messages are given as ArrayBuffer no matter if they are binary or not. Given ArrayBuffer is valid during the lifetime of this callback (until first await or return) and will be neutered.
|
|
89
|
-
// */
|
|
90
|
-
// dropped?: (
|
|
91
|
-
// ws: WebSocket/* <UserData> */,
|
|
92
|
-
// message: ArrayBuffer,
|
|
93
|
-
// isBinary: boolean,
|
|
94
|
-
// ) => void | Promise<void>,
|
|
95
|
-
|
|
96
|
-
// /**
|
|
97
|
-
// * Handler for when WebSocket backpressure drains. Check ws.getBufferedAmount(). Use this to guide / drive your backpressure throttling.
|
|
98
|
-
// */
|
|
99
|
-
// drain?: (
|
|
100
|
-
// ws: WebSocket/* <UserData> */,
|
|
101
|
-
// ) => void,
|
|
102
|
-
|
|
103
|
-
// /**
|
|
104
|
-
// * Handler for close event, no matter if error, timeout or graceful close. You may not use WebSocket after this event. Do not send on this WebSocket from within here, it is closed.
|
|
105
|
-
// */
|
|
106
|
-
// close?: (
|
|
107
|
-
// ws: WebSocket/* <UserData> */,
|
|
108
|
-
// code: number,
|
|
109
|
-
// message: ArrayBuffer,
|
|
110
|
-
// ) => void,
|
|
111
|
-
|
|
112
|
-
// /**
|
|
113
|
-
// * Handler for received ping control message. You do not need to handle this, pong messages are automatically sent as per the standard.
|
|
114
|
-
// */
|
|
115
|
-
// ping?: (
|
|
116
|
-
// ws: WebSocket/* <UserData> */,
|
|
117
|
-
// message: ArrayBuffer,
|
|
118
|
-
// ) => void,
|
|
119
|
-
|
|
120
|
-
// /**
|
|
121
|
-
// * Handler for received pong control message.
|
|
122
|
-
// */
|
|
123
|
-
// pong?: (
|
|
124
|
-
// ws: WebSocket/* <UserData> */,
|
|
125
|
-
// message: ArrayBuffer,
|
|
126
|
-
// ) => void,
|
|
127
|
-
|
|
128
|
-
// /**
|
|
129
|
-
// * Handler for subscription changes.
|
|
130
|
-
// */
|
|
131
|
-
// subscription?: (
|
|
132
|
-
// ws: WebSocket/* <UserData> */,
|
|
133
|
-
// topic: ArrayBuffer,
|
|
134
|
-
// newCount: number,
|
|
135
|
-
// oldCount: number,
|
|
136
|
-
// ) => void,
|
|
137
|
-
// }
|
|
138
|
-
"use strict";
|
|
139
|
-
//# sourceMappingURL=WebSocketBehaviour.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/WebSocketBehaviour.ts"],"mappings":"AAAA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA","ignoreList":[]}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
// import type {
|
|
2
|
-
// CompressOptions,
|
|
3
|
-
// } from "../modules/CompressOptions"
|
|
4
|
-
|
|
5
|
-
// import type {
|
|
6
|
-
// HttpRequest,
|
|
7
|
-
// } from "./HttpRequest"
|
|
8
|
-
|
|
9
|
-
// import type {
|
|
10
|
-
// HttpResponse,
|
|
11
|
-
// } from "./HttpResponse"
|
|
12
|
-
|
|
13
|
-
// import type {
|
|
14
|
-
// WebSocket,
|
|
15
|
-
// } from "./WebSocket"
|
|
16
|
-
|
|
17
|
-
// import type {
|
|
18
|
-
// us_socket_context_t,
|
|
19
|
-
// } from "./us_socket_context_t"
|
|
20
|
-
|
|
21
|
-
// /**
|
|
22
|
-
// * A structure holding settings and handlers for a WebSocket URL route handler.
|
|
23
|
-
// */
|
|
24
|
-
// export interface WebSocketBehavior/* <UserData> */ {
|
|
25
|
-
// /**
|
|
26
|
-
// * Maximum length of received message. If a client tries to send you a message larger than this, the connection is immediately closed. Defaults to 16 * 1024.
|
|
27
|
-
// */
|
|
28
|
-
// maxPayloadLength?: number,
|
|
29
|
-
|
|
30
|
-
// /**
|
|
31
|
-
// * Whether or not we should automatically close the socket when a message is dropped due to backpressure. Defaults to false.
|
|
32
|
-
// */
|
|
33
|
-
// closeOnBackpressureLimit?: boolean,
|
|
34
|
-
|
|
35
|
-
// /**
|
|
36
|
-
// * Maximum number of minutes a WebSocket may be connected before being closed by the server. 0 disables the feature. Valid values are 0 and 1-239.
|
|
37
|
-
// */
|
|
38
|
-
// maxLifetime?: number,
|
|
39
|
-
|
|
40
|
-
// /**
|
|
41
|
-
// * Maximum amount of seconds that may pass without sending or getting a message. Connection is closed if this timeout passes. Resolution (granularity) for timeouts are typically 4 seconds, rounded to closest.
|
|
42
|
-
// * Disable by using 0. Defaults to 120.
|
|
43
|
-
// */
|
|
44
|
-
// idleTimeout?: number,
|
|
45
|
-
|
|
46
|
-
// /**
|
|
47
|
-
// * What permessage-deflate compression to use. uWS.DISABLED, uWS.SHARED_COMPRESSOR or any of the uWS.DEDICATED_COMPRESSOR_xxxKB. Defaults to uWS.DISABLED.
|
|
48
|
-
// */
|
|
49
|
-
// compression?: CompressOptions,
|
|
50
|
-
|
|
51
|
-
// /**
|
|
52
|
-
// * Maximum length of allowed backpressure per socket when publishing or sending messages. Slow receivers with too high backpressure will be skipped until they catch up or timeout. Defaults to 64 * 1024.
|
|
53
|
-
// */
|
|
54
|
-
// maxBackpressure?: number,
|
|
55
|
-
|
|
56
|
-
// /**
|
|
57
|
-
// * Whether or not we should automatically send pings to uphold a stable connection given whatever idleTimeout.
|
|
58
|
-
// */
|
|
59
|
-
// sendPingsAutomatically?: boolean,
|
|
60
|
-
|
|
61
|
-
// /**
|
|
62
|
-
// * Upgrade handler used to intercept HTTP upgrade requests and potentially upgrade to WebSocket.
|
|
63
|
-
// * See UpgradeAsync and UpgradeSync example files.
|
|
64
|
-
// */
|
|
65
|
-
// upgrade?: (
|
|
66
|
-
// res: HttpResponse,
|
|
67
|
-
// req: HttpRequest,
|
|
68
|
-
// context: us_socket_context_t,
|
|
69
|
-
// ) => void | Promise<void>,
|
|
70
|
-
|
|
71
|
-
// /**
|
|
72
|
-
// * Handler for new WebSocket connection. WebSocket is valid from open to close, no errors.
|
|
73
|
-
// */
|
|
74
|
-
// open?: (
|
|
75
|
-
// ws: WebSocket/* <UserData> */,
|
|
76
|
-
// ) => void | Promise<void>,
|
|
77
|
-
|
|
78
|
-
// /**
|
|
79
|
-
// * Handler for a WebSocket message. Messages are given as ArrayBuffer no matter if they are binary or not. Given ArrayBuffer is valid during the lifetime of this callback (until first await or return) and will be neutered.
|
|
80
|
-
// */
|
|
81
|
-
// message?: (
|
|
82
|
-
// ws: WebSocket/* <UserData> */,
|
|
83
|
-
// message: ArrayBuffer,
|
|
84
|
-
// isBinary: boolean,
|
|
85
|
-
// ) => void | Promise<void>,
|
|
86
|
-
|
|
87
|
-
// /**
|
|
88
|
-
// * Handler for a dropped WebSocket message. Messages can be dropped due to specified backpressure settings. Messages are given as ArrayBuffer no matter if they are binary or not. Given ArrayBuffer is valid during the lifetime of this callback (until first await or return) and will be neutered.
|
|
89
|
-
// */
|
|
90
|
-
// dropped?: (
|
|
91
|
-
// ws: WebSocket/* <UserData> */,
|
|
92
|
-
// message: ArrayBuffer,
|
|
93
|
-
// isBinary: boolean,
|
|
94
|
-
// ) => void | Promise<void>,
|
|
95
|
-
|
|
96
|
-
// /**
|
|
97
|
-
// * Handler for when WebSocket backpressure drains. Check ws.getBufferedAmount(). Use this to guide / drive your backpressure throttling.
|
|
98
|
-
// */
|
|
99
|
-
// drain?: (
|
|
100
|
-
// ws: WebSocket/* <UserData> */,
|
|
101
|
-
// ) => void,
|
|
102
|
-
|
|
103
|
-
// /**
|
|
104
|
-
// * Handler for close event, no matter if error, timeout or graceful close. You may not use WebSocket after this event. Do not send on this WebSocket from within here, it is closed.
|
|
105
|
-
// */
|
|
106
|
-
// close?: (
|
|
107
|
-
// ws: WebSocket/* <UserData> */,
|
|
108
|
-
// code: number,
|
|
109
|
-
// message: ArrayBuffer,
|
|
110
|
-
// ) => void,
|
|
111
|
-
|
|
112
|
-
// /**
|
|
113
|
-
// * Handler for received ping control message. You do not need to handle this, pong messages are automatically sent as per the standard.
|
|
114
|
-
// */
|
|
115
|
-
// ping?: (
|
|
116
|
-
// ws: WebSocket/* <UserData> */,
|
|
117
|
-
// message: ArrayBuffer,
|
|
118
|
-
// ) => void,
|
|
119
|
-
|
|
120
|
-
// /**
|
|
121
|
-
// * Handler for received pong control message.
|
|
122
|
-
// */
|
|
123
|
-
// pong?: (
|
|
124
|
-
// ws: WebSocket/* <UserData> */,
|
|
125
|
-
// message: ArrayBuffer,
|
|
126
|
-
// ) => void,
|
|
127
|
-
|
|
128
|
-
// /**
|
|
129
|
-
// * Handler for subscription changes.
|
|
130
|
-
// */
|
|
131
|
-
// subscription?: (
|
|
132
|
-
// ws: WebSocket/* <UserData> */,
|
|
133
|
-
// topic: ArrayBuffer,
|
|
134
|
-
// newCount: number,
|
|
135
|
-
// oldCount: number,
|
|
136
|
-
// ) => void,
|
|
137
|
-
// }
|
|
138
|
-
"use strict";
|
|
139
|
-
//# sourceMappingURL=WebSocketBehaviour.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/WebSocketBehaviour.ts"],"mappings":"AAAA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=WebSocketBehaviour.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WebSocketBehaviour.d.ts","sourceRoot":"","sources":["../../../../src/types/WebSocketBehaviour.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=WebSocketBehaviour.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WebSocketBehaviour.d.ts","sourceRoot":"","sources":["../../../../src/types/WebSocketBehaviour.ts"],"names":[],"mappings":""}
|