You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/index.d.ts
+38-54Lines changed: 38 additions & 54 deletions
Original file line number
Diff line number
Diff line change
@@ -48,10 +48,9 @@ export type RecognizedString = string | ArrayBuffer | Uint8Array | Int8Array | U
48
48
* Read more about this in the user manual.
49
49
*/
50
50
exportinterfaceWebSocket<UserData>{
51
-
/** 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().
52
-
*
53
-
* Make sure you properly understand the concept of backpressure. Check the backpressure example file.
54
-
*/
51
+
/** 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.
52
+
* You can check backpressure before or after sending by calling getBufferedAmount().
53
+
* Make sure you properly understand the concept of backpressure. Check the backpressure example file. */
/** Ends this response, or tries to, by streaming appropriately sized chunks of body. Use in conjunction with onWritable. Returns tuple [ok, hasResponded].*/
/** Every HttpResponse MUST have an attached abort handler IF you do not respond
161
-
* to it immediately inside of the callback. Returning from an Http request handler
162
-
* without attaching (by calling onAborted) an abort handler is ill-use and will terminate.
163
-
* When this event emits, the response has been aborted and may not be used. */
137
+
/** Every HttpResponse MUST have an attached abort handler IF you perform any asynchronous operation.
138
+
* Returning from an HTTP request handler without attaching an abort handler is ill-use and will terminate.
139
+
* When this event is emitted, the response has been aborted and may not be used. */
164
140
onAborted(handler: ()=>void) : HttpResponse;
141
+
/** Immediately force closes the connection. Any onAborted callback will run. */
142
+
close() : HttpResponse;
165
143
166
-
/** Handler for reading data from POST and such requests. You MUST copy the data of chunk if isLast is not true. We Neuter ArrayBuffers on return, making it zero length.*/
144
+
/** Handler for reading HTTP request's body data.
145
+
* Must be attached before performing any asynchronous operation, otherwise data may be lost.
146
+
* You MUST copy the ArrayBuffer's data if isLast is not true. We Neuter ArrayBuffers on return, making them zero length. */
/** Setting yield to true is to say that this route handler did not handle the route, causing the router to continue looking for a matching route handler, or fail. */
/** 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. */
235
+
/** Handler for a WebSocket message. Messages are given as ArrayBuffer no matter if they are binary or not. We Neuter ArrayBuffers on return, making them zero length. */
/** 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. */
237
+
/** Handler for a dropped WebSocket message. Messages can be dropped due to specified backpressure settings. We Neuter ArrayBuffers on return, making them zero length. */
/** Handler for when WebSocket backpressure drains. Check ws.getBufferedAmount(). Use this to guide / drive your backpressure throttling. */
256
240
drain?: (ws: WebSocket<UserData>)=>void;
257
241
/** 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. */
0 commit comments