topgun-socket
Advanced tools
Comparing version 1.4.1 to 1.4.2
@@ -1,2 +0,2 @@ | ||
export { j as ChannelState, H as HandlerFunction, k as SCChannelOptions, i as TGChannel } from './auth-26900dc6.js'; | ||
export { j as ChannelState, H as HandlerFunction, k as SCChannelOptions, i as TGChannel } from './auth-3858d5be.js'; | ||
import 'topgun-jsonwebtoken'; |
@@ -1,4 +0,4 @@ | ||
import { S as SocketState, T as TGAuthEngine, C as CodecEngine, a as TGSocketClientOptions, E as EventObject, b as TransmitOptions, I as InvokeOptions, c as EventObjectCallback, d as IClientSocket, A as AuthState, P as ProtocolVersions, e as AuthToken, f as AuthEngine, g as AuthStatus, h as SubscribeOptions, i as TGChannel, j as ChannelState, k as SCChannelOptions } from './auth-26900dc6.js'; | ||
export { l as AutoReconnectOptions, m as CallIdGenerator, W as WatcherFunction } from './auth-26900dc6.js'; | ||
import { A as AsyncStreamEmitter, S as SocketProtocolIgnoreStatuses, a as SocketProtocolErrorStatuses, D as DemuxedAsyncIterableStream } from './types-5d41ea47.js'; | ||
import { S as SocketState, T as TGAuthEngine, C as CodecEngine, a as TGSocketClientOptions, E as EventObject, b as TransmitOptions, I as InvokeOptions, c as EventObjectCallback, d as IClientSocket, A as AuthState, P as ProtocolVersions, e as AuthToken, f as AuthEngine, g as AuthStatus, h as SubscribeOptions, i as TGChannel, j as ChannelState, k as SCChannelOptions } from './auth-3858d5be.js'; | ||
export { l as AutoReconnectOptions, m as CallIdGenerator, W as WatcherFunction } from './auth-3858d5be.js'; | ||
import { A as AsyncStreamEmitter, S as SocketProtocolIgnoreStatuses, a as SocketProtocolErrorStatuses, D as DemuxedAsyncIterableStream } from './types-36ca8aaa.js'; | ||
import 'topgun-jsonwebtoken'; | ||
@@ -5,0 +5,0 @@ |
import { Server } from 'http'; | ||
import { JwtSecret } from 'topgun-jsonwebtoken'; | ||
import { n as AuthEngineType, C as CodecEngine, i as TGChannel, j as ChannelState, S as SocketState, A as AuthState, e as AuthToken, o as AuthTokenOptions, M as Middlewares, p as MiddlewareFunction } from './auth-26900dc6.js'; | ||
import { A as AsyncStreamEmitter, S as SocketProtocolIgnoreStatuses, a as SocketProtocolErrorStatuses, D as DemuxedAsyncIterableStream } from './types-5d41ea47.js'; | ||
import { i as TGChannel, j as ChannelState, M as Middlewares, n as AuthEngineType, C as CodecEngine, o as MiddlewareFunction, e as AuthToken, S as SocketState, A as AuthState, p as AuthTokenOptions } from './auth-3858d5be.js'; | ||
import { A as AsyncStreamEmitter, S as SocketProtocolIgnoreStatuses, a as SocketProtocolErrorStatuses, D as DemuxedAsyncIterableStream } from './types-36ca8aaa.js'; | ||
interface TGSocketServerOptions { | ||
httpServer?: any; | ||
wsEngine?: string | { | ||
Server: any; | ||
}; | ||
wsEngineServerOptions?: any; | ||
authKey?: JwtSecret; | ||
perMessageDeflate?: boolean | object; | ||
authPrivateKey?: JwtSecret; | ||
authPublicKey?: JwtSecret; | ||
authDefaultExpiry?: number; | ||
authAlgorithm?: string; | ||
protocolVersion?: 1 | 2; | ||
handshakeTimeout?: number; | ||
ackTimeout?: number; | ||
origins?: string; | ||
socketChannelLimit?: number; | ||
pingInterval?: number; | ||
pingTimeout?: number; | ||
middlewareEmitFailures?: boolean; | ||
path?: string; | ||
allowClientPublish?: boolean; | ||
batchOnHandshake?: boolean; | ||
batchOnHandshakeDuration?: number; | ||
batchInterval?: number; | ||
socketStreamCleanupMode?: 'kill' | 'close'; | ||
authVerifyAlgorithms?: string[]; | ||
authEngine?: AuthEngineType; | ||
codecEngine?: CodecEngine; | ||
cloneData?: boolean; | ||
middlewareEmitWarnings?: boolean; | ||
[additionalOptions: string]: any; | ||
declare class SimpleExchange extends AsyncStreamEmitter<any> { | ||
private readonly _broker; | ||
private readonly _channelMap; | ||
private readonly _channelEventDemux; | ||
private readonly _channelDataDemux; | ||
/** | ||
* Constructor | ||
*/ | ||
constructor(broker: SimpleBroker); | ||
destroy(): void; | ||
publish(channelName: string, data: any): Promise<void>; | ||
subscribe(channelName: string): TGChannel<any>; | ||
unsubscribe(channelName: string): void; | ||
channel(channelName: string): TGChannel<any>; | ||
getChannelState(channelName: string): ChannelState; | ||
getChannelOptions(channelName: string): {}; | ||
subscriptions(includePending?: boolean): string[]; | ||
isSubscribed(channelName: string, includePending?: boolean): boolean; | ||
private _triggerChannelSubscribe; | ||
private _triggerChannelUnsubscribe; | ||
} | ||
interface IncomingMessage { | ||
remoteAddress?: string; | ||
remoteFamily?: any; | ||
remotePort?: number; | ||
forwardedForAddress?: any; | ||
} | ||
interface RequestObject { | ||
socket?: any; | ||
authTokenExpiredError?: Error; | ||
channel?: string; | ||
data?: any; | ||
ackData?: any; | ||
event?: string; | ||
waitForAuth?: boolean; | ||
} | ||
@@ -77,22 +50,86 @@ interface SimpleSocket { | ||
declare class SimpleExchange extends AsyncStreamEmitter<any> { | ||
private readonly _broker; | ||
private readonly _channelMap; | ||
private readonly _channelEventDemux; | ||
private readonly _channelDataDemux; | ||
declare class TGSocketServer extends AsyncStreamEmitter<any> { | ||
options: TGSocketServerOptions; | ||
MIDDLEWARE_HANDSHAKE_WS: Middlewares; | ||
MIDDLEWARE_HANDSHAKE_AG: Middlewares; | ||
MIDDLEWARE_TRANSMIT: Middlewares; | ||
MIDDLEWARE_INVOKE: Middlewares; | ||
MIDDLEWARE_SUBSCRIBE: Middlewares; | ||
MIDDLEWARE_PUBLISH_IN: Middlewares; | ||
MIDDLEWARE_PUBLISH_OUT: Middlewares; | ||
MIDDLEWARE_AUTHENTICATE: Middlewares; | ||
origins: string; | ||
ackTimeout: number; | ||
handshakeTimeout: number; | ||
pingInterval: number; | ||
pingTimeout: number; | ||
pingTimeoutDisabled: boolean; | ||
allowClientPublish: boolean; | ||
perMessageDeflate: boolean | object; | ||
httpServer: any; | ||
socketChannelLimit: number; | ||
brokerEngine: SimpleBroker; | ||
appName: string; | ||
middlewareEmitWarnings: boolean; | ||
isReady: boolean; | ||
signatureKey: JwtSecret; | ||
verificationKey: JwtSecret; | ||
authVerifyAsync: boolean; | ||
authSignAsync: boolean; | ||
defaultVerificationOptions: any; | ||
defaultSignatureOptions: any; | ||
auth: AuthEngineType; | ||
codec: CodecEngine; | ||
clients: { | ||
[id: string]: TGSocket; | ||
}; | ||
clientsCount: number; | ||
pendingClients: { | ||
[id: string]: TGSocket; | ||
}; | ||
pendingClientsCount: number; | ||
exchange: SimpleExchange; | ||
private readonly _middleware; | ||
private readonly _allowAllOrigins; | ||
private readonly wsServer; | ||
private readonly _path; | ||
/** | ||
* Constructor | ||
*/ | ||
constructor(broker: SimpleBroker); | ||
destroy(): void; | ||
publish(channelName: string, data: any): Promise<void>; | ||
subscribe(channelName: string): TGChannel<any>; | ||
unsubscribe(channelName: string): void; | ||
channel(channelName: string): TGChannel<any>; | ||
getChannelState(channelName: string): ChannelState; | ||
getChannelOptions(channelName: string): {}; | ||
subscriptions(includePending?: boolean): string[]; | ||
isSubscribed(channelName: string, includePending?: boolean): boolean; | ||
private _triggerChannelSubscribe; | ||
private _triggerChannelUnsubscribe; | ||
constructor(options: TGSocketServerOptions); | ||
setAuthEngine(authEngine: AuthEngineType): void; | ||
setCodecEngine(codecEngine: CodecEngine): void; | ||
emitError(error: Error): void; | ||
emitWarning(warning: Error): void; | ||
close(keepSocketsOpen?: boolean): Promise<void>; | ||
getPath(): string; | ||
generateId(): string; | ||
addMiddleware(type: Middlewares, middleware: MiddlewareFunction): void; | ||
removeMiddleware(type: Middlewares, middleware: MiddlewareFunction): void; | ||
verifyHandshake(info: { | ||
origin?: string; | ||
secure?: boolean; | ||
req?: IncomingMessage; | ||
}, callback: (res: boolean, code?: number, message?: string, headers?: any) => void): Promise<void>; | ||
verifyInboundRemoteEvent(requestOptions: any, callback: (err: Error, newEventData?: any, ackData?: any) => any): void; | ||
isAuthTokenExpired(token: AuthToken): boolean; | ||
verifyOutboundEvent(socket: any, eventName: string, eventData: any, options: any, callback: (err: Error, data?: any) => any): Promise<void>; | ||
private _processSubscribeAction; | ||
private _processTransmitAction; | ||
private _processPublishAction; | ||
private _processInvokeAction; | ||
private _passThroughMiddleware; | ||
private _isReservedRemoteEvent; | ||
private _handleServerError; | ||
private _handleHandshakeTimeout; | ||
private _handleSocketErrors; | ||
private _subscribeSocket; | ||
private _unsubscribeSocketFromAllChannels; | ||
private _unsubscribeSocket; | ||
private _processTokenError; | ||
private _emitBadAuthTokenError; | ||
private _processAuthToken; | ||
private _passThroughAuthenticateMiddleware; | ||
private _passThroughHandshakeAGMiddleware; | ||
private _handleSocketConnection; | ||
} | ||
@@ -184,87 +221,50 @@ | ||
declare class TGSocketServer extends AsyncStreamEmitter<any> { | ||
options: TGSocketServerOptions; | ||
MIDDLEWARE_HANDSHAKE_WS: Middlewares; | ||
MIDDLEWARE_HANDSHAKE_AG: Middlewares; | ||
MIDDLEWARE_TRANSMIT: Middlewares; | ||
MIDDLEWARE_INVOKE: Middlewares; | ||
MIDDLEWARE_SUBSCRIBE: Middlewares; | ||
MIDDLEWARE_PUBLISH_IN: Middlewares; | ||
MIDDLEWARE_PUBLISH_OUT: Middlewares; | ||
MIDDLEWARE_AUTHENTICATE: Middlewares; | ||
origins: string; | ||
ackTimeout: number; | ||
handshakeTimeout: number; | ||
pingInterval: number; | ||
pingTimeout: number; | ||
pingTimeoutDisabled: boolean; | ||
allowClientPublish: boolean; | ||
perMessageDeflate: boolean | object; | ||
httpServer: any; | ||
socketChannelLimit: number; | ||
brokerEngine: SimpleBroker; | ||
appName: string; | ||
middlewareEmitWarnings: boolean; | ||
isReady: boolean; | ||
signatureKey: JwtSecret; | ||
verificationKey: JwtSecret; | ||
authVerifyAsync: boolean; | ||
authSignAsync: boolean; | ||
defaultVerificationOptions: any; | ||
defaultSignatureOptions: any; | ||
auth: AuthEngineType; | ||
codec: CodecEngine; | ||
clients: { | ||
[id: string]: TGSocket; | ||
interface TGSocketServerOptions { | ||
httpServer?: any; | ||
wsEngine?: string | { | ||
Server: any; | ||
}; | ||
clientsCount: number; | ||
pendingClients: { | ||
[id: string]: TGSocket; | ||
}; | ||
pendingClientsCount: number; | ||
exchange: SimpleExchange; | ||
private readonly _middleware; | ||
private readonly _allowAllOrigins; | ||
private readonly wsServer; | ||
private readonly _path; | ||
/** | ||
* Constructor | ||
*/ | ||
constructor(options: TGSocketServerOptions); | ||
setAuthEngine(authEngine: AuthEngineType): void; | ||
setCodecEngine(codecEngine: CodecEngine): void; | ||
emitError(error: Error): void; | ||
emitWarning(warning: Error): void; | ||
close(keepSocketsOpen?: boolean): Promise<void>; | ||
getPath(): string; | ||
generateId(): string; | ||
addMiddleware(type: Middlewares, middleware: MiddlewareFunction): void; | ||
removeMiddleware(type: Middlewares, middleware: MiddlewareFunction): void; | ||
verifyHandshake(info: { | ||
origin?: string; | ||
secure?: boolean; | ||
req?: IncomingMessage; | ||
}, callback: (res: boolean, code?: number, message?: string, headers?: any) => void): Promise<void>; | ||
verifyInboundRemoteEvent(requestOptions: any, callback: (err: Error, newEventData?: any, ackData?: any) => any): void; | ||
isAuthTokenExpired(token: AuthToken): boolean; | ||
verifyOutboundEvent(socket: any, eventName: string, eventData: any, options: any, callback: (err: Error, data?: any) => any): Promise<void>; | ||
private _processSubscribeAction; | ||
private _processTransmitAction; | ||
private _processPublishAction; | ||
private _processInvokeAction; | ||
private _passThroughMiddleware; | ||
private _isReservedRemoteEvent; | ||
private _handleServerError; | ||
private _handleHandshakeTimeout; | ||
private _handleSocketErrors; | ||
private _subscribeSocket; | ||
private _unsubscribeSocketFromAllChannels; | ||
private _unsubscribeSocket; | ||
private _processTokenError; | ||
private _emitBadAuthTokenError; | ||
private _processAuthToken; | ||
private _passThroughAuthenticateMiddleware; | ||
private _passThroughHandshakeAGMiddleware; | ||
private _handleSocketConnection; | ||
wsEngineServerOptions?: any; | ||
authKey?: JwtSecret; | ||
perMessageDeflate?: boolean | object; | ||
authPrivateKey?: JwtSecret; | ||
authPublicKey?: JwtSecret; | ||
authDefaultExpiry?: number; | ||
authAlgorithm?: string; | ||
protocolVersion?: 1 | 2; | ||
handshakeTimeout?: number; | ||
ackTimeout?: number; | ||
origins?: string; | ||
socketChannelLimit?: number; | ||
pingInterval?: number; | ||
pingTimeout?: number; | ||
middlewareEmitFailures?: boolean; | ||
path?: string; | ||
allowClientPublish?: boolean; | ||
batchOnHandshake?: boolean; | ||
batchOnHandshakeDuration?: number; | ||
batchInterval?: number; | ||
socketStreamCleanupMode?: 'kill' | 'close'; | ||
authVerifyAlgorithms?: string[]; | ||
authEngine?: AuthEngineType; | ||
codecEngine?: CodecEngine; | ||
cloneData?: boolean; | ||
middlewareEmitWarnings?: boolean; | ||
[additionalOptions: string]: any; | ||
} | ||
interface IncomingMessage { | ||
remoteAddress?: string; | ||
remoteFamily?: any; | ||
remotePort?: number; | ||
forwardedForAddress?: any; | ||
} | ||
interface RequestObject { | ||
socket?: TGSocket; | ||
authTokenExpiredError?: Error; | ||
channel?: string; | ||
data?: any; | ||
ackData?: any; | ||
event?: string; | ||
waitForAuth?: boolean; | ||
} | ||
@@ -271,0 +271,0 @@ type ListenFn = (...rest: any[]) => void; |
{ | ||
"name": "topgun-socket", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"description": "Scalable realtime pub/sub and RPC serverless framework", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
336116