Using Autobahn with wxPython (a UI toolkit)

#1

Hi,

Quick note: Twisted and UI toolkits works great!

Here is how you do WebSocket communication from a wxPython based app:

https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/websocket/wxpython

I've never worked with wxPython before, but people are using it with Autobahn

http://stackoverflow.com/questions/24496312/wxpython-and-autobahn-websockets

The example uses raw WebSocket, which - as you might guess - isn't what I'd recommend. Using WAMP, and RPC + PubSub would make more sense. Well, I leave porting as an exercise to the interested;) It's easy.

Of course other UI toolkits would work also, e.g. the Kivy

http://kivy.org/

cool aid rocks.

Anyway. Got distracted for another hour. Back to work;)

/Tobias

0 Likes

#2

Took me slightly more than another hour of distraction, but finally I’ve got a Kivy client for the websocket Echo server.
You can find its Github Gist here: https://gist.github.com/rogererens/2f8370ee83ab074f5b5e

If you happen to have Kivy installed on your machine, and you can import autobahn in the Kivy-interpreter, then

first fire up the Websocket Echo server from

https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/echo/server.py

followed by

kivy client_kivy.py

You can type text in the white textbox; its echo will be shown in the label above it.

See the screenshot attached.

I’d love getting some feedback.

Hopefully we can get it polished enough to make it into the repo of AutobahnPython.

As a next step, I hope to be able to use WAMP instead of raw websockets soon. Unfortunately I’m not a WAMP-guru, so it won’t be easy for me…

Roger

···

The example uses raw WebSocket, which - as you might guess - isn’t what
I’d recommend. Using WAMP, and RPC + PubSub would make more sense. Well,
I leave porting as an exercise to the interested;) It’s easy.

Of course other UI toolkits would work also, e.g. the Kivy

http://kivy.org/

cool aid rocks.

Anyway. Got distracted for another hour. Back to work;)

/Tobias

0 Likes