How to use the zeromq.Socket function in zeromq

To help you get started, we’ve selected a few zeromq examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github n-riesco / jmp / index.js View on Github external
* @classdesc ZMQ socket that parses the Jupyter Messaging Protocol
 *
 * @param {String|Number} socketType ZMQ socket type
 * @param {String} [scheme="sha256"] Hashing scheme
 * @param {String} [key=""] Hashing key
 */
function Socket(socketType, scheme, key) {
    zmq.Socket.call(this, socketType);
    this._jmp = {
        scheme: scheme,
        key: key,
        _listeners: [],
    };
}

Socket.prototype = Object.create(zmq.Socket.prototype);
Socket.prototype.constructor = Socket;

/**
 * Send the given message.
 *
 * @param {module:jmp~Message|String|Buffer|Array} message
 * @param {Number} flags
 * @returns {module:jmp~Socket} `this` to allow chaining
 *
 */
Socket.prototype.send = function(message, flags) {
    var p = Object.getPrototypeOf(Socket.prototype);

    if (message instanceof Message) {
        log("SOCKET: SEND:", message);
github n-riesco / jmp / index.js View on Github external
function Socket(socketType, scheme, key) {
    zmq.Socket.call(this, socketType);
    this._jmp = {
        scheme: scheme,
        key: key,
        _listeners: [],
    };
}