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
+35-51Lines changed: 35 additions & 51 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 throw.
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.
147
+
* We Neuter ArrayBuffers on return, making it zero length. */
/** Corking a response is a performance improvement in both CPU and network, as you ready the IO system for writing multiple chunks at once.
182
-
* By default, you're corked in the immediately executing top portion of the route handler. In all other cases, such as when returning from
183
-
* await, or when being called back from an async database request or anything that isn't directly executing in the route handler, you'll want
184
-
* to cork before calling writeStatus, writeHeader or just write. Corking takes a callback in which you execute the writeHeader, writeStatus and
185
-
* such calls, in one atomic IO operation. This is important, not only for TCP but definitely for TLS where each write would otherwise result
186
-
* in one TLS block being sent off, each with one send syscall.
168
+
* This is important, not only for TCP but definitely for TLS where each write would otherwise result in one syscall and TLS block being sent off.
169
+
* You're corked in the Http request handler, but once you performed any asynchronous operation, you should cork before calling any write* or end* functions.
170
+
* Corking takes a callback in which you execute such calls, in one atomic IO operation.
/** 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. */
0 commit comments