Added local and volatile flag for socket.io SocketIO.Server interface (#20199)

This commit is contained in:
Alexey
2017-10-03 20:29:22 +03:00
committed by Ryan Cavanaugh
parent 2ff4dff832
commit 42b2a4c53e
2 changed files with 21 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
// Type definitions for socket.io 1.4.4
// Project: http://socket.io/
// Definitions by: PROGRE <https://github.com/progre>, Damian Connolly <https://github.com/divillysausages>, Florent Poujol <https://github.com/florentpoujol>, KentarouTakeda <https://github.com/KentarouTakeda>
// Definitions by: PROGRE <https://github.com/progre>, Damian Connolly <https://github.com/divillysausages>, Florent Poujol <https://github.com/florentpoujol>, KentarouTakeda <https://github.com/KentarouTakeda>, Alexey Snigirev <https://github.com/gigi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///<reference types="node" />
@@ -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

View File

@@ -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');
}