mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
Merge pull request #23370 from TitaneBoy/@types/zeromq
@types/zeromq - Add proxy function type
This commit is contained in:
Vendored
+11
@@ -240,3 +240,14 @@ export function createSocket(type: string, options?: any): Socket;
|
||||
* @return The public and secret portions of the key.
|
||||
*/
|
||||
export function curveKeypair(): CurveKeyPair;
|
||||
|
||||
/**
|
||||
* Connects a frontend socket to a backend socket.
|
||||
* @param frontend The frontend socket to connect with the backend socket.
|
||||
* Frontend socket should be a 'push', 'pull', 'xpub', 'router' or 'xrep' socket.
|
||||
* @param backend The backend socket to connect with the frontend socket.
|
||||
* Backend socket should be a 'pull', 'push', 'xsub', 'dealer' or 'xreq' socket.
|
||||
* @param capture If defined, this socket will receive all messages from frontend and backend socket
|
||||
* Capture socket should be a 'pub', 'dealer', 'push' or 'pair' socket.
|
||||
*/
|
||||
export function proxy(frontend: Socket, backend: Socket, capture ?: Socket): void;
|
||||
|
||||
@@ -48,3 +48,13 @@ function test6() {
|
||||
sock.pause();
|
||||
sock.resume();
|
||||
}
|
||||
|
||||
function test7() {
|
||||
const xPubSocket = zeromq.socket('xpub');
|
||||
const xPSubSocket = zeromq.socket('xsub');
|
||||
|
||||
xPubSocket.bindSync(`tcp://127.0.0.1:3000`);
|
||||
xPSubSocket.bindSync('tcp://127.0.0.1:3001');
|
||||
|
||||
zeromq.proxy(xPubSocket, xPSubSocket);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user