Beispiel #1
0
def main():
    args = parse_args()

    ws_url = os.environ.get("WS_URL", "ws://localhost:8000/ws")
    domain = os.environ.get("DOMAIN", "xs")

    if args['--agent'] != "None":
        domain = args['--agent']

    if args['--debug']:
        riffle.SetLogLevelDebug()

    if not args['--quiet']:
        print("Node:   {}".format(ws_url))
        print("Domain: {}".format(domain))
        print("---")

    riffle.SetFabric(ws_url)
    ExisSession(domain, args).join()
Beispiel #2
0
# Template Setup
import riffle
from riffle import want

riffle.SetFabricLocal()
riffle.SetLogLevelDebug()


class GenericDomain(riffle.Domain):
    def onJoin(self):
        # End Template Setup

        # Example Tour Basics 2 - async NOTE this code won't run since pub/sub is in line
        @want(int)
        def async (i):
            print i

        self.subscribe("async", async)
        # End Example Tour Basics 2

        print "___SETUPCOMPLETE___"


# Template Setup
app = riffle.Domain("xs.demo.test")  # ARBITER $DOMAIN replaces "xs.demo.test"

client = riffle.Domain("client", superdomain=app)
backend = riffle.Domain("backend", superdomain=app)

GenericDomain("client",
              superdomain=app).join()  # ARBITER $SUBDOMAIN replaces "client"