From 4128f7af06c355e3526b7cf7cbb85e2e43bff167 Mon Sep 17 00:00:00 2001 From: Florent Poujol Date: Sun, 17 Jan 2016 21:46:29 +0100 Subject: [PATCH] Update definitions for socket.io to v1.4.4. --- socket.io/socket.io.d.ts | 58 +++++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 12 deletions(-) diff --git a/socket.io/socket.io.d.ts b/socket.io/socket.io.d.ts index 355606858..67fb7dd9a 100644 --- a/socket.io/socket.io.d.ts +++ b/socket.io/socket.io.d.ts @@ -1,6 +1,6 @@ -// Type definitions for socket.io 1.3.5 +// Type definitions for socket.io 1.4.4 // Project: http://socket.io/ -// Definitions by: PROGRE , Damian Connolly +// Definitions by: PROGRE , Damian Connolly , Florent Poujol // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -248,6 +248,18 @@ declare module SocketIO { * @see send( ...args ) */ write( ...args: any[] ): Namespace; + + /** + * Gets a list of clients + * @return The default '/' Namespace + */ + clients( ...args: any[] ): Namespace; + + /** + * Sets the compress flag + * @return The default '/' Namespace + */ + compress( ...args: any[] ): Namespace; } /** @@ -360,9 +372,10 @@ declare module SocketIO { server: Server; /** - * A list of all the Sockets connected to this Namespace + * A dictionary of all the Sockets connected to this Namespace, where + * the Socket ID is the key */ - sockets: Socket[]; + sockets: { [id: string]: Socket }; /** * A dictionary of all the Sockets connected to this Namespace, where @@ -437,6 +450,19 @@ declare module SocketIO { * @ This Namespace */ on( event: string, listener: Function ): Namespace; + + /** + * Gets a list of clients. + * @return This Namespace + */ + clients( fn: Function ): Namespace; + + /** + * Sets the compress flag. + * @param compress If `true`, compresses the sending data + * @return This Namespace + */ + compress( compress: boolean ): Namespace; } /** @@ -506,9 +532,10 @@ declare module SocketIO { }; /** - * The list of rooms that this Socket is currently in + * The list of rooms that this Socket is currently in, where + * the ID the the room ID */ - rooms: string[]; + rooms: { [id: string]: string }; /** * Is the Socket currently connected? @@ -702,6 +729,13 @@ declare module SocketIO { * @return An array of callback Functions, or an empty array if we don't have any */ listeners( event: string ):Function[]; + + /** + * Sets the compress flag + * @param compress If `true`, compresses the sending data + * @return This Socket + */ + compress( compress: boolean ): Socket; } /** @@ -715,10 +749,10 @@ declare module SocketIO { nsp: Namespace; /** - * A dictionary of all the rooms that we have in this namespace, each room - * a dictionary of all the sockets currently in that room + * A dictionary of all the rooms that we have in this namespace + * The rooms are made of a `sockets` key which is the dictionary of sockets per ID */ - rooms: {[room: string]: {[id: string]: boolean }}; + rooms: {[room: string]: {sockets: {[id: string]: boolean }}}; /** * A dictionary of all the socket ids that we're dealing with, and all @@ -809,10 +843,10 @@ declare module SocketIO { request: any; /** - * The list of sockets currently connect via this client (i.e. to different - * namespaces) + * The dictionary of sockets currently connect via this client (i.e. to different + * namespaces) where the Socket ID is the key */ - sockets: Socket[]; + sockets: {[id: string]: Socket}; /** * A dictionary of all the namespaces for this client, with the Socket that