Merge pull request #3597 from panuhorsmalahti/zeromq-unbind-socket

Add ZeroMQ unbind function types
This commit is contained in:
Masahiro Wakame
2015-02-05 02:24:34 +09:00
2 changed files with 22 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ import zmq = require('zmq');
function test1() {
var sock = zmq.socket('push');
sock.bindSync('tcp://127.0.0.1:3000');
sock.unbindSync('tcp://127.0.0.1:3000');
sock.send("some work");
}
@@ -28,6 +29,9 @@ function test4() {
sock.bind('tcp://127.0.0.1', err => {
sock.send("some work");
});
sock.unbind('tcp://127.0.0.1', err => {
//
});
}
function test5() {

19
node_zeromq/zmq.d.ts vendored
View File

@@ -85,7 +85,7 @@ declare module 'zmq' {
* @param addr Socket address
* @param cb Bind callback
*/
bind(addr: string, callback: (error: string) => void ): Socket;
bind(addr: string, callback?: (error: string) => void ): Socket;
/**
* Sync bind.
@@ -94,6 +94,23 @@ declare module 'zmq' {
*/
bindSync(addr: string): Socket;
/**
* Async unbind.
*
* Emits the "unbind" event.
*
* @param addr Socket address
* @param cb Unind callback
*/
unbind(addr: string, callback?: (error: string) => void ): Socket;
/**
* Sync unbind.
*
* @param addr Socket address
*/
unbindSync(addr: string): Socket;
/**
* Connect to `addr`.
*