Skip to content

Commit 087ebf8

Browse files
authored
types: add AppDescriptor type and methods for worker threads (#1131)
Added: - AppDescriptor interface as a native type (similar to us_listen_socket) - Methods on TemplatedApp: - getDescriptor() - addChildAppDescriptor() - removeChildAppDescriptor()
1 parent 59a0510 commit 087ebf8

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎docs/index.d.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ export interface us_socket_context_t {
3232

3333
}
3434

35+
/** Native type representing a raw uWebSockets struct AppDescriptor.
36+
* Used internally for worker thread distribution.
37+
* Careful with this one, it is entirely unchecked and native so invalid usage will blow up.
38+
*/
39+
export interface AppDescriptor {
40+
41+
}
42+
3543
/** Recognized string types, things C++ can read and understand as strings.
3644
* "String" does not have to mean "text", it can also be "binary".
3745
*
@@ -365,6 +373,12 @@ export interface TemplatedApp {
365373
filter(cb: (res: HttpResponse, count: Number) => void | Promise<void>) : TemplatedApp;
366374
/** Closes all sockets including listen sockets. This will forcefully terminate all connections. */
367375
close() : TemplatedApp;
376+
/** Returns the app descriptor for worker thread distribution. */
377+
getDescriptor(): AppDescriptor;
378+
/** Add a child app descriptor for worker thread distribution. */
379+
addChildAppDescriptor(descriptor: AppDescriptor): void;
380+
/** Remove a child app descriptor. */
381+
removeChildAppDescriptor(descriptor: AppDescriptor): void;
368382
}
369383

370384
/** Constructs a non-SSL app. An app is your starting point where you attach behavior to URL routes.

0 commit comments

Comments
 (0)