@Tobias? :)
how can i, from clientA, trigger a function on clientB, whereby clientB runs several functions and publishes to several endpoints, and each publish() is forwarded immediately through crossbar instead of waiting until clientB has finished performing all functions?
e.g.
browser js
clientA does either an rpc call or publish to
com.example.triggerpython backend
clientB, having either a matching rpc function or subscription callback for
com.example.trigger (doesn't matter which i use) then runs callback(). callback will look like the following:
class Butterfly(ApplicationSession):
@inlineCallbacks
def __yield(self, uri, data):
logger.info(log some stuff)
yield self.publish(uri, data)
@wamp.register(com.example.trigger)
def callback(self, opts):
@asyncio.coroutine
def foo1(opts):
results=compute() # takes <1 second
__yield(com.example.something1, results)
@asyncio.coroutine
def foo2(opts):
results=compute() # takes <1 second
__yield(com.example.something2, results)
@asyncio.coroutine
def foo3(opts):
results=compute() # takes <1 second
__yield(com.example.something3, results)
@asyncio.coroutine
def foo4(opts):
results=compute() # takes 60 seconds
__yield(com.example.something4, results)
loop = asyncio.get_event.loop()
tasks = [asyncio.Task(foo1(opts)),
asyncio.Task(foo2(opts)),
asyncio.Task(foo3(opts)),
asyncio.Task(foo4(opts))]
loop.run_until_complete(asyncio.wait(tasks))
at present, crossbar router does see published data immediately for the first three functions foo1(), foo2(), and foo3(); but it waits until after foo4() has completed before any of the published data is forwarded to the browser client. --loglevel debug and tcpdump confirms it.
how do i make crossbar forward the messages immediately to subscribed clients using a single trigger?