Architecture questions

#1

Hi everybody!
I’m trying to figure out if Autobahn could be the right choice for my architecture. After few days of reading documentation, I need some help :slight_smile:

What I need is bidirectional real time messages between multiple client app ad a server app.

My server is an API endpoint written in Flask and this have to interact with another python program, to send it command and variables.

What I want to achieve is this workflow:

1 - a user connect to an API endpoint, for example www.example.com/api/mission passing the parameter ‘start=true’ or ‘machine=3’ or ‘stop=true’

2 - the flask app connect via websocket (or wamp?) to the python app listening for incoming messages

3 - the flask app authenticate

4 - the flask app send the message to the app and wait for a response (for example I want an ack for every command or I want some statistics back).

Using different endpoints and parameters you can send different commands to the python client. Moreover, I will need in the future to be able to command multiple python programs from the same flask app.

It seemed that everything I need could be done with Autobahn. I was looking to ZeroMQ but seemed too much complex, RabbitMQ has unidirectional messages.

I’m trying to modify the echo server/client example in order to send through weboscket the user keyboard input but without success, maybe because the example is not async and I’m still studying that part.

What do you think? Am I in the right path? Should I look to another technology?

Best,

Matteo

0 Likes

#2

Hi Matteo,

I'd say WebSocket and WAMP is a good fit in general for the things you want to do.

The main "issue" is with Flask.

Flask (as well as all other WSGI based Python frameworks) works synchronously. And this does not directly blend with Autobahn, which is fully asynchronous.

There are multiple ways to "work around":

···

- http://tavendo.com/blog/post/going-asynchronous-from-flask-to-twisted-klein/
- http://tavendo.com/blog/post/mixing-web-and-wamp-code-with-twisted-klein/

You might also look into Crochet (sadly, I did not find time yet to write up a blog post on this approach ..)

Probably we need some iterations in this discussion to set you on the right track .. pls let me know if above is already of use for you ..

Cheers,
/Tobias

Am 10.09.2014 01:44, schrieb Matteo Ruina:

Hi everybody!
I'm trying to figure out if Autobahn could be the right choice for my
architecture. After few days of reading documentation, I need some help :slight_smile:

What I need is bidirectional real time messages between multiple client
app ad a server app.
My server is an API endpoint written in Flask and this have to interact
with another python program, to send it command and variables.

What I want to achieve is this workflow:
1 - a user connect to an API endpoint, for example
www.example.com/api/mission passing the parameter 'start=true' or
'machine=3' or 'stop=true'
2 - the flask app connect via websocket (or wamp?) to the python app
listening for incoming messages
3 - the flask app authenticate
4 - the flask app send the message to the app and wait for a response
(for example I want an ack for every command or I want some statistics
back).

Using different endpoints and parameters you can send different commands
to the python client. Moreover, I will need in the future to be able to
command multiple python programs from the same flask app.

It seemed that everything I need could be done with Autobahn. I was
looking to ZeroMQ but seemed too much complex, RabbitMQ has
unidirectional messages.

I'm trying to modify the echo server/client example in order to send
through weboscket the user keyboard input but without success, maybe
because the example is not async and I'm still studying that part.

What do you think? Am I in the right path? Should I look to another
technology?

Best,
Matteo

--
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
<mailto:autobahnws+...@googlegroups.com>.
To post to this group, send email to autob...@googlegroups.com
<mailto:autob...@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/autobahnws/641cc37f-d533-40c6-97d7-5ac3a93c0f91%40googlegroups.com
<https://groups.google.com/d/msgid/autobahnws/641cc37f-d533-40c6-97d7-5ac3a93c0f91%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

0 Likes

#3

Thanks Tobias, I will look at your link and write again if I need more!

Best,

Matteo

···

On Thursday, September 11, 2014 6:25:54 AM UTC-3, Tobias Oberstein wrote:

Hi Matteo,

I’d say WebSocket and WAMP is a good fit in general for the things you
want to do.

The main “issue” is with Flask.

Flask (as well as all other WSGI based Python frameworks) works
synchronously. And this does not directly blend with Autobahn, which is
fully asynchronous.

There are multiple ways to “work around”:

http://tavendo.com/blog/post/going-asynchronous-from-flask-to-twisted-klein/

You might also look into Crochet (sadly, I did not find time yet to
write up a blog post on this approach …)

Probably we need some iterations in this discussion to set you on the
right track … pls let me know if above is already of use for you …

Cheers,

/Tobias

Am 10.09.2014 01:44, schrieb Matteo Ruina:

Hi everybody!

I’m trying to figure out if Autobahn could be the right choice for my

architecture. After few days of reading documentation, I need some help :slight_smile:

What I need is bidirectional real time messages between multiple client

app ad a server app.

My server is an API endpoint written in Flask and this have to interact

with another python program, to send it command and variables.

What I want to achieve is this workflow:

1 - a user connect to an API endpoint, for example

www.example.com/api/mission passing the parameter ‘start=true’ or

‘machine=3’ or ‘stop=true’

2 - the flask app connect via websocket (or wamp?) to the python app

listening for incoming messages

3 - the flask app authenticate

4 - the flask app send the message to the app and wait for a response

(for example I want an ack for every command or I want some statistics

back).

Using different endpoints and parameters you can send different commands

to the python client. Moreover, I will need in the future to be able to

command multiple python programs from the same flask app.

It seemed that everything I need could be done with Autobahn. I was

looking to ZeroMQ but seemed too much complex, RabbitMQ has

unidirectional messages.

I’m trying to modify the echo server/client example in order to send

through weboscket the user keyboard input but without success, maybe

because the example is not async and I’m still studying that part.

What do you think? Am I in the right path? Should I look to another

technology?

Best,

Matteo

0 Likes