add zmq.Socket.pause and zmq.Socket.resume

This commit is contained in:
Thomas Achleitner
2016-06-22 13:21:32 +02:00
parent 830586ef55
commit 7eb02641a2
2 changed files with 22 additions and 0 deletions
+9
View File
@@ -42,3 +42,12 @@ function test5() {
sock.monitor();
sock.monitor(10);
}
function test6() {
var sock = zmq.socket(zmq.types.dealer);
sock.bind('tcp://127.0.0.1', err => {
sock.send("some work");
});
sock.pause();
sock.resume();
}
+13
View File
@@ -184,6 +184,19 @@ declare module 'zmq' {
*/
on(eventName: string, callback: (...buffer: Buffer[]) => void): void;
/**
* Set socket to pause mode
* no data will be emit until resume() is called
* all send() calls will be queued
*/
pause(): void;
/**
* Set a socket back to normal work mode
* triggers a _flushReads and _flushWrites
*/
resume(): void;
// Socket Options
_fd: any;
_ioevents: any;