Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

types: add AppDescriptor type and methods for worker threads #1131

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ export interface us_socket_context_t {

}

/** Native type representing a raw uWebSockets struct AppDescriptor.
* Used internally for worker thread distribution.
* Careful with this one, it is entirely unchecked and native so invalid usage will blow up.
*/
export interface AppDescriptor {

}

/** Recognized string types, things C++ can read and understand as strings.
* "String" does not have to mean "text", it can also be "binary".
*
Expand Down Expand Up @@ -331,6 +339,12 @@ export interface TemplatedApp {
filter(cb: (res: HttpResponse, count: Number) => void | Promise<void>) : TemplatedApp;
/** Closes all sockets including listen sockets. This will forcefully terminate all connections. */
close() : TemplatedApp;
/** Returns the app descriptor for worker thread distribution. */
getDescriptor(): AppDescriptor;
/** Add a child app descriptor for worker thread distribution. */
addChildAppDescriptor(descriptor: AppDescriptor): void;
/** Remove a child app descriptor. */
removeChildAppDescriptor(descriptor: AppDescriptor): void;
}

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