Server#close takes a callback function.

This commit is contained in:
武田 憲太郎 2017-02-15 19:21:00 +09:00
parent e79e2e64a6
commit a4fcf4a0f2
2 changed files with 12 additions and 1 deletions

View File

@ -180,7 +180,7 @@ declare namespace SocketIO {
/**
* Closes the server connection
*/
close():void;
close( fn ?: () => void ):void;
/**
* The event fired when we get a new connection

View File

@ -143,3 +143,14 @@ function testUsingItJustAsACrossBrowserWebSocket() {
socket.on('disconnect', function () { });
});
}
function testClosingServerWithCallback() {
var io = socketIO.listen(80);
io.close(function() {
});
}
function testClosingServerWithoutCallback() {
var io = socketIO.listen(80);
io.close();
}