You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
wondering if it's possible to make primus-callbacks work on a substream? It currently works on main stream and I believe it's only about writing implementation for primus-callbacks writeAndWait method.
/**
* Write a new message to the streams and wait for response
*
* @param {Mixed} msg The data that needs to be written.
* @param {Func} done nodejs style callback (err, response)
* @returns {Boolean}
* @api public
*/
SubStream.prototype.writeAndWait = function write(msg, done) {
// TODO: implementation here
};
I'll try to implement it myself, but I'm bit lost in how transform works. What does this code actually do?
/**
* Write a new message to the streams.
*
* @param {Mixed} msg The data that needs to be written.
* @returns {Boolean}
* @api public
*/
SubStream.prototype.write = function write(msg) {
if (!this.stream) return false;
this.stream.transforms(this.primus, this, 'outgoing', msg);
return true;
};
and when this get invoked?
/**
* Actually write the message.
*
* @param {Mixed} msg The data that needs to be written.
* @returns {Boolean}
* @api private
*/
SubStream.prototype._write = function write(msg) {
return this.stream._write({
substream: this.name,
args: msg
});
};
Thanks
The text was updated successfully, but these errors were encountered:
It calls the transforms method on the Spark or the client.
That transforms method runs the registered message transformers and then call SubStream.prototype._write (see the second argument) with the transformed data.
Hi there,
wondering if it's possible to make primus-callbacks work on a substream? It currently works on main stream and I believe it's only about writing implementation for primus-callbacks
writeAndWait
method.I'll try to implement it myself, but I'm bit lost in how transform works. What does this code actually do?
and when this get invoked?
Thanks
The text was updated successfully, but these errors were encountered: