Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@based/uws

Package Overview
Dependencies
Maintainers
7
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@based/uws - npm Package Compare versions

Comparing version 4.1.0 to 5.0.0

ESM_wrapper.mjs

66

index.d.ts

@@ -190,5 +190,7 @@ /*

*
* ```
* res.cork(() => {
* res.writeStatus("200 OK").writeHeader("Some", "Value").write("Hello world!");
* });
* ```
*/

@@ -218,8 +220,8 @@ cork(cb: () => void) : HttpResponse;

getQuery() : string;
/** Returns a decoded query parameter value or empty string. */
getQuery(key: string) : string;
/** Returns a decoded query parameter value or undefined. */
getQuery(key: string) : string | undefined;
/** Loops over all headers. */
forEach(cb: (key: string, value: string) => void) : void;
/** 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. */
setYield(yield: boolean) : HttpRequest;
setYield(_yield: boolean) : HttpRequest;
}

@@ -248,7 +250,9 @@

*/
upgrade?: (res: HttpResponse, req: HttpRequest, context: us_socket_context_t) => void;
upgrade?: (res: HttpResponse, req: HttpRequest, context: us_socket_context_t) => void | Promise<void>;
/** Handler for new WebSocket connection. WebSocket is valid from open to close, no errors. */
open?: (ws: WebSocket<UserData>) => void;
open?: (ws: WebSocket<UserData>) => void | Promise<void>;
/** 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. */
message?: (ws: WebSocket<UserData>, message: ArrayBuffer, isBinary: boolean) => void;
message?: (ws: WebSocket<UserData>, message: ArrayBuffer, isBinary: boolean) => void | Promise<void>;
/** 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. */
dropped?: (ws: WebSocket<UserData>, message: ArrayBuffer, isBinary: boolean) => void | Promise<void>;
/** Handler for when WebSocket backpressure drains. Check ws.getBufferedAmount(). Use this to guide / drive your backpressure throttling. */

@@ -288,27 +292,29 @@ drain?: (ws: WebSocket<UserData>) => void;

/** Listens to hostname & port. Callback hands either false or a listen socket. */
listen(host: RecognizedString, port: number, cb: (listenSocket: us_listen_socket) => void): TemplatedApp;
listen(host: RecognizedString, port: number, cb: (listenSocket: us_listen_socket | false) => void | Promise<void>) : TemplatedApp;
/** Listens to port. Callback hands either false or a listen socket. */
listen(port: number, cb: (listenSocket: any) => void): TemplatedApp;
listen(port: number, cb: (listenSocket: us_listen_socket | false) => void | Promise<void>) : TemplatedApp;
/** Listens to port and sets Listen Options. Callback hands either false or a listen socket. */
listen(port: number, options: ListenOptions, cb: (listenSocket: us_listen_socket | false) => void): TemplatedApp;
listen(port: number, options: ListenOptions, cb: (listenSocket: us_listen_socket | false) => void | Promise<void>) : TemplatedApp;
/** Listens to unix socket. Callback hands either false or a listen socket. */
listen_unix(cb: (listenSocket: us_listen_socket) => void | Promise<void>, path: RecognizedString) : TemplatedApp;
/** Registers an HTTP GET handler matching specified URL pattern. */
get(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void) : TemplatedApp;
get(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void | Promise<void>) : TemplatedApp;
/** Registers an HTTP POST handler matching specified URL pattern. */
post(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void) : TemplatedApp;
post(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void | Promise<void>) : TemplatedApp;
/** Registers an HTTP OPTIONS handler matching specified URL pattern. */
options(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void) : TemplatedApp;
options(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void | Promise<void>) : TemplatedApp;
/** Registers an HTTP DELETE handler matching specified URL pattern. */
del(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void) : TemplatedApp;
del(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void | Promise<void>) : TemplatedApp;
/** Registers an HTTP PATCH handler matching specified URL pattern. */
patch(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void) : TemplatedApp;
patch(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void | Promise<void>) : TemplatedApp;
/** Registers an HTTP PUT handler matching specified URL pattern. */
put(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void) : TemplatedApp;
put(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void | Promise<void>) : TemplatedApp;
/** Registers an HTTP HEAD handler matching specified URL pattern. */
head(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void) : TemplatedApp;
head(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void | Promise<void>) : TemplatedApp;
/** Registers an HTTP CONNECT handler matching specified URL pattern. */
connect(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void) : TemplatedApp;
connect(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void | Promise<void>) : TemplatedApp;
/** Registers an HTTP TRACE handler matching specified URL pattern. */
trace(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void) : TemplatedApp;
trace(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void | Promise<void>) : TemplatedApp;
/** Registers an HTTP handler matching specified URL pattern on any HTTP method. */
any(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void) : TemplatedApp;
any(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void | Promise<void>) : TemplatedApp;
/** Registers a handler matching specified URL pattern where WebSocket upgrade requests are caught. */

@@ -321,7 +327,13 @@ ws<UserData>(pattern: RecognizedString, behavior: WebSocketBehavior<UserData>) : TemplatedApp;

/** Adds a server name. */
addServerName(hostname: string, options: AppOptions): TemplatedApp;
addServerName(hostname: string, options: AppOptions) : TemplatedApp;
/** Browse to SNI domain. Used together with .get, .post and similar to attach routes under SNI domains. */
domain(domain: string) : TemplatedApp;
/** Removes a server name. */
removeServerName(hostname: string): TemplatedApp;
removeServerName(hostname: string) : TemplatedApp;
/** Registers a synchronous callback on missing server names. See /examples/ServerName.js. */
missingServerName(cb: (hostname: string) => void): TemplatedApp;
missingServerName(cb: (hostname: string) => void) : TemplatedApp;
/** Attaches a "filter" function to track socket connections / disconnections */
filter(cb: (res: HttpResponse, count: Number) => void | Promise<void>) : TemplatedApp;
/** Closes all sockets including listen sockets. This will forcefully terminate all connections. */
close() : TemplatedApp;
}

@@ -332,12 +344,12 @@

*/
export function App(options?: AppOptions): TemplatedApp;
export function App(options?: AppOptions) : TemplatedApp;
/** Constructs an SSL app. See App. */
export function SSLApp(options: AppOptions): TemplatedApp;
export function SSLApp(options: AppOptions) : TemplatedApp;
/** Closes a uSockets listen socket. */
export function us_listen_socket_close(listenSocket: us_listen_socket): void;
export function us_listen_socket_close(listenSocket: us_listen_socket) : void;
/** Gets local port of socket (or listenSocket) or -1. */
export function us_socket_local_port(socket: us_socket): number;
export function us_socket_local_port(socket: us_socket) : number;

@@ -352,3 +364,3 @@ export interface MultipartField {

/** Takes a POSTed body and contentType, and returns an array of parts if the request is a multipart request */
export function getParts(body: RecognizedString, contentType: RecognizedString): MultipartField[] | undefined;
export function getParts(body: RecognizedString, contentType: RecognizedString) : MultipartField[] | undefined;

@@ -355,0 +367,0 @@ /** WebSocket compression options. Combine any compressor with any decompressor using bitwise OR. */

{
"name": "@based/uws",
"version": "4.1.0",
"version": "5.0.0",
"license": "Apache-2.0",
"main": "uws.js",
"types": "./index.d.ts"
"types": "./index.d.ts",
"exports": {
"import": "./ESM_wrapper.mjs",
"require": "./uws.js",
"types": "./index.d.ts"
}
}

@@ -22,4 +22,4 @@ /*

} catch (e) {
throw new Error('This version of uWS.js supports only Node.js 16 and 18, and 19 on (glibc) Linux, macOS and Windows, on Tier 1 platforms (https://github.com/nodejs/node/blob/master/BUILDING.md#platform-list).\n\n' + e.toString());
throw new Error('This version of uWS.js supports only Node.js LTS versions 16, 18 and 20 on (glibc) Linux, macOS and Windows, on Tier 1 platforms (https://github.com/nodejs/node/blob/master/BUILDING.md#platform-list).\n\n' + e.toString());
}
})();

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc