diff --git a/types/socket.io/index.d.ts b/types/socket.io/index.d.ts index 41863235ba..0d77110716 100644 --- a/types/socket.io/index.d.ts +++ b/types/socket.io/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for socket.io 1.4.4 // Project: http://socket.io/ -// Definitions by: PROGRE , Damian Connolly , Florent Poujol , KentarouTakeda +// Definitions by: PROGRE , Damian Connolly , Florent Poujol , KentarouTakeda , Alexey Snigirev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -64,6 +64,16 @@ declare namespace SocketIO { */ json: Server; + /** + * Sets a modifier for a subsequent event emission that the event data may be lost if the clients are not ready to receive messages + */ + volatile: Server; + + /** + * Sets a modifier for a subsequent event emission that the event data will only be broadcast to the current node + */ + local: Server; + /** * Server request verification function, that checks for allowed origins * @param req The http.IncomingMessage request diff --git a/types/socket.io/socket.io-tests.ts b/types/socket.io/socket.io-tests.ts index 23c4a6d996..cd0cecf6cf 100644 --- a/types/socket.io/socket.io-tests.ts +++ b/types/socket.io/socket.io-tests.ts @@ -170,3 +170,13 @@ function testClosingServerWithoutCallback() { var io = socketIO.listen(80); io.close(); } + +function testLocalServerMessages() { + var io = socketIO.listen(80); + io.local.emit('local', 'Local data'); +} + +function testVolatileServerMessages() { + var io = socketIO.listen(80); + io.volatile.emit('volatile', 'Lost data'); +}