AutobahnJS and streaming

#1

hi,

Is there a simple way (perhaps an example?) to use the streaming interface from AutobahnJS for an rpc call?

Perhaps it is possible already, but I can’t find any simple examples which use it.

It would be great if the streaming interface was a little easier to use. The ideal would be to have a ‘stream’ decorator for my generator function and to have a ‘call’ function in AutobahnJS which could handle the streamed responses.

There is a very nice example in zerorpc (http://zerorpc.dotcloud.com) which does exactly this- it would be great if I could do streaming rpc in autobahn like this!

thanks,

import zerorpc
class StreamingRPC(object):
    @zerorpc.stream
    def streaming_range(self, fr, to, step):
        return xrange(fr, to, step)
s = zerorpc.Server(StreamingRPC())
s.bind("tcp://0.0.0.0:4242")

var zerorpc = require(“zerorpc”
);
var client = new zerorpc.Client();
client.connect(“tcp://127.0.0.1:4242”
);
client.invoke(“streaming_range”, 10, 20, 2, function (error, res, more) {
console.log(res);
});

0 Likes

#2

hi,

Is there a simple way (perhaps an example?) to use the streaming
interface from AutobahnJS for an rpc call?

AutobahnJS does not have a "streaming interface" if you mean "streaming WebSocket API". The latter is available in AutobahnPython only. The WS API in browsers is always message-based.

Perhaps it is possible already, but I can't find any simple examples
which use it.

It would be great if the streaming interface was a little easier to
use. The ideal would be to have a 'stream' decorator for my generator
function and to have a 'call' function in AutobahnJS which could handle
the streamed responses.

There is a very nice example in zerorpc
(http://zerorpc.dotcloud.com) which does exactly this- it would be great

The web site does not work for me: "Application Access Disabled"

if I could do streaming rpc in autobahn like this!

WAMPv2 (and AutobahnJS, AutobahnPython, AutobahnAndroid, ..) will feature "progressive RPC results", which I guess will allow you to do what you want!

Tobias

···

Am 25.04.2013 17:22, schrieb tcb:

thanks,

import zerorpc

class StreamingRPC(object):
     @zerorpc.stream
     def streaming_range(self, fr, to, step):
         return xrange(fr, to, step)

s = zerorpc.Server(StreamingRPC())
s.bind("tcp://0.0.0.0:4242")

var zerorpc = require("zerorpc");

var client =new zerorpc.Client();
client.connect("tcp://127.0.0.1:4242");

client.invoke("streaming_range",10,20,2,function(error, res, more) {
     console.log(res);
});

--
You received this message because you are subscribed to the Google
Groups "Autobahn" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to autobahnws+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Likes

#3

hi,

Is there a simple way (perhaps an example?) to use the streaming

interface from AutobahnJS for an rpc call?

AutobahnJS does not have a “streaming interface” if you mean “streaming
WebSocket API”. The latter is available in AutobahnPython only. The WS
API in browsers is always message-based.

Ok- I need to call a python generator function and have it send the results of each iteration, which I suppose could be encapsulated either in a frame or a message. In this case ‘progressive rpc’ might be a better description.

Perhaps it is possible already, but I can’t find any simple examples

which use it.

It would be great if the streaming interface was a little easier to

use. The ideal would be to have a ‘stream’ decorator for my generator

function and to have a ‘call’ function in AutobahnJS which could handle

the streamed responses.

There is a very nice example in zerorpc

(http://zerorpc.dotcloud.com) which does exactly this- it would be great

The web site does not work for me: “Application Access Disabled”

oh well, the code is here: https://github.com/dotcloud/zerorpc-python

if I could do streaming rpc in autobahn like this!

WAMPv2 (and AutobahnJS, AutobahnPython, AutobahnAndroid, …) will
feature “progressive RPC results”, which I guess will allow you to do
what you want!

sound’s perfect!

I guess this is work in progress…?

thanks,

···

On Thursday, April 25, 2013 4:49:28 PM UTC+1, Tobias Oberstein wrote:

Am 25.04.2013 17:22, schrieb tcb:

Tobias

thanks,

import zerorpc

class StreamingRPC(object):

 @zerorpc.stream
 def  streaming_range(self, fr, to, step):
     return  xrange(fr, to, step)

s = zerorpc.Server(StreamingRPC())

s.bind(“tcp://0.0.0.0:4242”)

var zerorpc = require(“zerorpc”);

var client =new zerorpc.Client();

client.connect(“tcp://127.0.0.1:4242”);

client.invoke(“streaming_range”,10,20,2,function(error, res, more) {

 console.log(res);

});

You received this message because you are subscribed to the Google

Groups “Autobahn” group.

To unsubscribe from this group and stop receiving emails from it, send

an email to autobahnws+...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

0 Likes

#4

    WAMPv2 (and AutobahnJS, AutobahnPython, AutobahnAndroid, ..) will
    feature "progressive RPC results", which I guess will allow you to do
    what you want!

sound's perfect!

I guess this is work in progress...?

Yep:

https://github.com/tavendo/wamp/blob/master/WAMPv2.md#the-call_progress-message

0 Likes