From f133fc0c1e9f34236a2caa0c79570b1bd25c7895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Mon, 13 Mar 2017 19:46:15 +0900 Subject: [PATCH] Client#conn, Socket#conn is an instance of engine.Socket, including properties "request" and "upgraded". https://github.com/socketio/socket.io/blob/master/docs/API.md#socketconn https://github.com/socketio/socket.io/blob/master/docs/API.md#clientconn https://github.com/socketio/engine.io#properties-2 --- socket.io/index.d.ts | 86 ++++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 44 deletions(-) diff --git a/socket.io/index.d.ts b/socket.io/index.d.ts index f6c94363ec..8e2ec2aade 100644 --- a/socket.io/index.d.ts +++ b/socket.io/index.d.ts @@ -509,28 +509,7 @@ declare namespace SocketIO { /** * The underlying Engine.io Socket instance */ - conn: { - - /** - * The ID for this socket - matches Client.id - */ - id: string; - - /** - * The Engine.io Server for this socket - */ - server: any; - - /** - * The ready state for the client. Either 'opening', 'open', 'closing', or 'closed' - */ - readyState: string; - - /** - * The remote IP for this connection - */ - remoteAddress: string; - }; + conn: EngineSocket; /** * The list of rooms that this Socket is currently in, where @@ -751,28 +730,7 @@ declare namespace SocketIO { /** * The underlying Engine.io Socket instance */ - conn: { - - /** - * The ID for this socket - matches Client.id - */ - id: string; - - /** - * The Engine.io Server for this socket - */ - server: any; - - /** - * The ready state for the client. Either 'opening', 'open', 'closing', or 'closed' - */ - readyState: string; - - /** - * The remote IP for this connection - */ - remoteAddress: string; - }; + conn: EngineSocket; /** * The ID for this client. Regenerated at every connection @@ -797,4 +755,44 @@ declare namespace SocketIO { */ nsps: {[nsp: string]: Socket}; } + + /** + * A reference to the underlying engine.io Socket connection. + */ + interface EngineSocket extends NodeJS.EventEmitter { + /** + * The ID for this socket - matches Client.id + */ + id: string; + + /** + * The Engine.io Server for this socket + */ + server: any; + + /** + * The ready state for the client. Either 'opening', 'open', 'closing', or 'closed' + */ + readyState: string; + + /** + * The remote IP for this connection + */ + remoteAddress: string; + + /** + * whether the transport has been upgraded + */ + upgraded: boolean; + + /** + * (http.IncomingMessage): request that originated the Socket + */ + request: any; + + /** + * (Transport): transport reference + */ + transport: any; + } }