Specific directions for WSGI + web socket within the same process?

33 views
Skip to first unread message

David Zentgraf

unread,
Feb 16, 2015, 3:12:40 AM2/16/15
to python...@googlegroups.com
Hi,

I'm trying to write a WSGI component which can also send and receive (Autobahn) web socket WAMP events for integration as a RESTful endpoint in a Crossbar application. Rough sample:

value = None

class Foo(ApplicationSession):
   
def onJoin(self, details):
       
yield self.subscribe(self.bar, 'bar')

   
def bar(self, data):
        value
= data


app
= Flask(__name__)

@app.route('/')
def baz():
   
return value


if __name__ == '__main__':
    runner
= ApplicationRunner('ws://127.0.0.1:8080', 'test')
    runner
.run(Foo, start_reactor=False)

   
# now what?

I'm under the impression that Pulsar should be able to help me out here, allowing me to spin up an event loop for the web socket and also offer a WSGI interface that Crossbar can use to run the web service with. I have not been able to figure out how to hook that up exactly though. Can you please give me some directions?

I've also posted this on Stack Overflow: http://stackoverflow.com/q/28536611/476

Best,
Dav
Reply all
Reply to author
Forward
0 new messages