-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose .createStream() #73
Comments
Probably not, @visionmedia can correct me but exposing the stream (for the use of composing new streams) wouldn't really mesh well with the protocol, really even with the messaging paradigm in general because of the whole |
I dont recall us even having a .createStream() anywhere |
I just wondered if it would be possible. I want to use axon-rcp for auth stuff and thus need encryption, that's my use case... |
Yeah, I assumed @juliangruber meant add one to the api. Like mongoose or something, ala: subSocket.stream().pipe(whatever); Right? |
server: var rpc = require('axon-rpc')
, axon = require('axon')
, rep = axon.socket('rep')
, net = require('net');
var server = new rpc.Server(rep);
// instead of this: rep.bind(4000);
net.createServer(function (socket) {
socket.pipe(server.createStream()).pipe(socket)
}).listen(4000) client: var rpc = require('axon-rpc')
, axon = require('axon')
, req = axon.socket('req')
, net = require('net');
var client = new rpc.Client(req);
var clientStream = client.createStream();
// with the net module
clientStream.pipe(net.connect(4000)).pipe(clientStream());
// or with dominictarr's reconnect:
reconnect(function (stream) {
clientStream.pipe(stream).pipe(clientStream)
}).connect(4000) This way you make it transport agnostic and it will also work in the browser over websockets, or whatevs! |
im fine with it as long as:
though personally there wouldn't really be many use-cases to use it for anything but regular tcp, not all transports have the same capabilities, via stdin etc would be leaky |
👍 |
I want to use axon with secure-peer for super easy security and thus need access to the raw stream. Any plans on doing this?
The text was updated successfully, but these errors were encountered: