@fastify/websocket
Advanced tools
Comparing version 7.1.3 to 7.2.0
@@ -197,1 +197,3 @@ 'use strict' | ||
}) | ||
module.exports.default = fastifyWebsocket | ||
module.exports.fastifyWebsocket = fastifyWebsocket |
{ | ||
"name": "@fastify/websocket", | ||
"version": "7.1.3", | ||
"version": "7.2.0", | ||
"description": "basic websocket support for fastify", | ||
@@ -37,3 +37,3 @@ "main": "index.js", | ||
"tap": "^16.0.0", | ||
"tsd": "^0.26.0" | ||
"tsd": "^0.28.0" | ||
}, | ||
@@ -40,0 +40,0 @@ "dependencies": { |
@@ -19,3 +19,3 @@ /// <reference types="node" /> | ||
> { | ||
wsHandler?: WebsocketHandler<RawServer, RawRequest, RequestGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>; | ||
wsHandler?: fastifyWebsocket.WebsocketHandler<RawServer, RawRequest, RequestGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>; | ||
} | ||
@@ -48,3 +48,3 @@ | ||
opts: RouteShorthandOptions<RawServer, RawRequest, RawReply, RequestGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger> & { websocket: true }, // this creates an overload that only applies these different types if the handler is for websockets | ||
handler?: WebsocketHandler<RawServer, RawRequest, RequestGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger> | ||
handler?: fastifyWebsocket.WebsocketHandler<RawServer, RawRequest, RequestGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger> | ||
): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>; | ||
@@ -65,41 +65,48 @@ } | ||
declare const websocketPlugin: FastifyPluginCallback<WebsocketPluginOptions>; | ||
type FastifyWebsocket = FastifyPluginCallback<fastifyWebsocket.WebsocketPluginOptions>; | ||
interface WebSocketServerOptions extends Omit<WebSocket.ServerOptions, "path"> { } | ||
declare namespace fastifyWebsocket { | ||
export type WebsocketHandler< | ||
RawServer extends RawServerBase = RawServerDefault, | ||
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>, | ||
RequestGeneric extends RequestGenericInterface = RequestGenericInterface, | ||
ContextConfig = ContextConfigDefault, | ||
SchemaCompiler extends FastifySchema = FastifySchema, | ||
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault, | ||
Logger extends FastifyBaseLogger = FastifyBaseLogger | ||
> = ( | ||
this: FastifyInstance<Server, IncomingMessage, ServerResponse>, | ||
connection: SocketStream, | ||
request: FastifyRequest<RequestGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider, ContextConfig, Logger> | ||
) => void | Promise<any>; | ||
interface WebSocketServerOptions extends Omit<WebSocket.ServerOptions, "path"> { } | ||
export type WebsocketHandler< | ||
RawServer extends RawServerBase = RawServerDefault, | ||
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>, | ||
RequestGeneric extends RequestGenericInterface = RequestGenericInterface, | ||
ContextConfig = ContextConfigDefault, | ||
SchemaCompiler extends FastifySchema = FastifySchema, | ||
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault, | ||
Logger extends FastifyBaseLogger = FastifyBaseLogger | ||
> = ( | ||
this: FastifyInstance<Server, IncomingMessage, ServerResponse>, | ||
connection: SocketStream, | ||
request: FastifyRequest<RequestGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider, ContextConfig, Logger> | ||
) => void | Promise<any>; | ||
export interface SocketStream extends Duplex { | ||
socket: WebSocket; | ||
} | ||
export interface WebsocketPluginOptions { | ||
errorHandler?: (this: FastifyInstance, error: Error, connection: SocketStream, request: FastifyRequest, reply: FastifyReply) => void; | ||
options?: WebSocketServerOptions; | ||
connectionOptions?: DuplexOptions; | ||
} | ||
export interface SocketStream extends Duplex { | ||
socket: WebSocket; | ||
} | ||
export interface RouteOptions< | ||
RawServer extends RawServerBase = RawServerDefault, | ||
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>, | ||
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>, | ||
RouteGeneric extends RouteGenericInterface = RouteGenericInterface, | ||
ContextConfig = ContextConfigDefault, | ||
SchemaCompiler extends fastify.FastifySchema = fastify.FastifySchema, | ||
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault, | ||
Logger extends FastifyBaseLogger = FastifyBaseLogger | ||
> extends fastify.RouteOptions<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>, WebsocketRouteOptions<RawServer, RawRequest, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger> { } | ||
export interface WebsocketPluginOptions { | ||
errorHandler?: (this: FastifyInstance, error: Error, connection: SocketStream, request: FastifyRequest, reply: FastifyReply) => void; | ||
options?: WebSocketServerOptions; | ||
connectionOptions?: DuplexOptions; | ||
export const websocketPlugin: FastifyWebsocket | ||
export { websocketPlugin as default } | ||
} | ||
export interface RouteOptions< | ||
RawServer extends RawServerBase = RawServerDefault, | ||
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>, | ||
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>, | ||
RouteGeneric extends RouteGenericInterface = RouteGenericInterface, | ||
ContextConfig = ContextConfigDefault, | ||
SchemaCompiler extends fastify.FastifySchema = fastify.FastifySchema, | ||
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault, | ||
Logger extends FastifyBaseLogger = FastifyBaseLogger | ||
> extends fastify.RouteOptions<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger>, WebsocketRouteOptions<RawServer, RawRequest, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger> { } | ||
export default websocketPlugin; | ||
declare function fastifyWebsocket(...params: Parameters<FastifyWebsocket>): ReturnType<FastifyWebsocket> | ||
export = fastifyWebsocket |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
81513
1831