mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
fix(SCServer): add missing events
This commit is contained in:
+17
@@ -33,6 +33,13 @@ declare class SCServer extends EventEmitter {
|
||||
constructor(options?: SCServer.SCServerOptions);
|
||||
|
||||
on(event: "connection", listener: SCServer.connectionListenerFunction): this;
|
||||
on(event: "ready", listener: () => void): this;
|
||||
on(event: "error", listener: (error: Error) => void): this;
|
||||
on(event: "disconnection" | "connectionAbort" | "closure", listener: SCServer.disconnectionListenerFunction): this;
|
||||
on(event: "subscription", listener: SCServer.subscriptionListenerFunction): this;
|
||||
on(event: "unsubscription", listener: SCServer.unsubscriptionListenerFunction): this;
|
||||
on(event: "handshake", listener: SCServer.handshakeListenerFunction): this;
|
||||
on(event: "badSocketAuthToken", listener: SCServer.badSocketAuthTokenListenerFunction): this;
|
||||
|
||||
addMiddleware(type: "handshakeWS", middlewareFn: (req: IncomingMessage, next: SCServer.nextMiddlewareFunction) => void): void;
|
||||
addMiddleware(type: "handshakeSC", middlewareFn: (req: SCServer.HandshakeSCRequest, next: SCServer.nextHandshakeSCMiddlewareFunction) => void): void;
|
||||
@@ -305,10 +312,20 @@ declare namespace SCServer {
|
||||
data?: any;
|
||||
}
|
||||
|
||||
interface badAuthStatus {
|
||||
authError: Error;
|
||||
signedAuthToken: string;
|
||||
}
|
||||
|
||||
type nextMiddlewareFunction = (error?: true | string | Error) => void;
|
||||
type nextHandshakeSCMiddlewareFunction = (error?: true | string | Error | null, statusCode?: number) => void;
|
||||
type nextAuthenticateMiddlewareFunction = (error?: true | string | Error | null, isBadToken?: boolean) => void;
|
||||
type connectionListenerFunction = (scSocket: SCServerSocket, serverSocketStatus: SCServerSocketStatus) => void;
|
||||
type disconnectionListenerFunction = (scSocket: SCServerSocket, code: number, data: any) => void;
|
||||
type subscriptionListenerFunction = (scSocket: SCServerSocket, name: string, options: {channel: string}) => void;
|
||||
type unsubscriptionListenerFunction = (scSocket: SCServerSocket, name: string, channel: string) => void;
|
||||
type handshakeListenerFunction = (scSocket: SCServerSocket) => void;
|
||||
type badSocketAuthTokenListenerFunction = (scSocket: SCServerSocket, status: badAuthStatus) => void;
|
||||
|
||||
interface SCCodecEngine {
|
||||
decode: (input: any) => any;
|
||||
|
||||
Reference in New Issue
Block a user