Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You could give stargate a bash: <a href="http://boothead.github.com/stargate/" rel="nofollow">http://boothead.github.com/stargate/</a> and <a href="http://pypi.python.org/pypi/stargate/" rel="nofollow">http://pypi.python.org/pypi/stargate/</a>.</p> <p>It's built on top of pyramid and eventlet (I also contributed a fair bit of the websocket support and tests to eventlet). The big advantage of pyramid for this sort of thing is that it's got the concept of a resource which the url maps to, rather than just the result of a callable. So you end up with a graph of persistent resources that maps to your url structure and websocket connections are simply routed and connected to those resources.</p> <p>So you end up only needing to do two things:</p> <pre><code>class YourView(WebSocketView): def handler(self, websocket): self.request.context.add_listener(websocket) while True: msg = websocket.wait() # Do something with message </code></pre> <p>To receive messages and </p> <pre><code>resource.send(some_other_message) </code></pre> <p>Here resource is an instance of a stargate.resource.WebSocketAwareContext (as is self.request.context) above and the send method sends the message to all clients connected with the add_listener method.</p> <p>To publish a message to all of the connected clients you just call <code>node.send(message)</code></p> <p>I'm hopefully going to write up a little example app in the next week or two to demonstrate this a little better.</p> <p>Feel free to ping me on github if you want some help with it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload