How do you run an ordinary twisted component as a crossbar container ?

#1

I got some Twisted code installing themself in a rector, and I’d like to edit them to make them compatible with crossbar.

Let’s take a very simple example :

from twisted.internet import reactor
from twisted.web.client import Agent
from twisted.web.http_headers import Headers

agent = Agent(reactor)

d = agent.request(‘GET’, ‘http://tavendo.com/’)

def cbResponse(ignored):
print ‘Response received’
d.addCallback(cbResponse)

def cbShutdown(ignored):
reactor.stop()
d.addBoth(cbShutdown)

reactor.run()

How do I make that a runnable container by crossbar ?

0 Likes

#2

Hi Michel,

this

https://github.com/tavendo/AutobahnPython/blob/issue208/examples/twisted/wamp/work/test4.py

works with

https://github.com/tavendo/AutobahnPython/blob/issue208/examples/twisted/wamp/work/test4.html

This app component can be hosted by Crossbar.

Essentially, you can host any callable that takes a ComponentConfig and produces an ApplicationSession.

Cheers,
/Tobias

···

Am 16.06.2014 16:21, schrieb Michel Desmoulin:

I got some Twisted code installing themself in a rector, and I'd like to
edit them to make them compatible with crossbar.

Let's take a very simple example :

from twisted.internet import reactor
from twisted.web.client import Agent
from twisted.web.http_headers import Headers

agent = Agent(reactor)

d = agent.request('GET', 'http://tavendo.com/')

def cbResponse(ignored):
    print 'Response received'
d.addCallback(cbResponse)

def cbShutdown(ignored):
     reactor.stop()
d.addBoth(cbShutdown)

reactor.run()

How do I make that a runnable container by crossbar ?

--
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>.
For more options, visit https://groups.google.com/d/optout.

0 Likes

#3

Thanks, that’s what I was looking for.

···

On Monday, June 16, 2014 9:57:39 PM UTC+7, Tobias Oberstein wrote:

Hi Michel,

this

https://github.com/tavendo/AutobahnPython/blob/issue208/examples/twisted/wamp/work/test4.py

works with

https://github.com/tavendo/AutobahnPython/blob/issue208/examples/twisted/wamp/work/test4.html

This app component can be hosted by Crossbar.

Essentially, you can host any callable that takes a ComponentConfig and
produces an ApplicationSession.

Cheers,

/Tobias

Am 16.06.2014 16:21, schrieb Michel Desmoulin:

I got some Twisted code installing themself in a rector, and I’d like to

edit them to make them compatible with crossbar.

Let’s take a very simple example :

from twisted.internet import reactor

from twisted.web.client import Agent

from twisted.web.http_headers import Headers

agent = Agent(reactor)

d = agent.request(‘GET’, ‘http://tavendo.com/’)

def cbResponse(ignored):

print 'Response received'

d.addCallback(cbResponse)

def cbShutdown(ignored):

 reactor.stop()

d.addBoth(cbShutdown)

reactor.run()

How do I make that a runnable container by crossbar ?

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+unsub...@googlegroups.com.

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

0 Likes