mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-13 22:40:50 +08:00
Added local and volatile flag for socket.io SocketIO.Server interface (#20199)
This commit is contained in:
12
types/socket.io/index.d.ts
vendored
12
types/socket.io/index.d.ts
vendored
@@ -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
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user