Created
September 27, 2017 21:46
-
-
Save agronholm/86ad21955c192ef124531df253ad3738 to your computer and use it in GitHub Desktop.
Sample trio WAMP applications
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import trio | |
from wampproto.impl.client.trio import TrioWAMPClient | |
def procedure_handler(name): | |
return 'Hello, {}!'.format(name) | |
async def main(): | |
async with client.connect(): | |
await client.register(procedure_handler, 'hello') | |
await trio.sleep_forever() | |
logging.basicConfig(level=logging.DEBUG) | |
client = TrioWAMPClient('ws://localhost:8080/', 'realm1') | |
try: | |
trio.run(main) | |
except KeyboardInterrupt: | |
pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import trio | |
from wampproto.impl.client.trio import TrioWAMPClient | |
async def main(): | |
async with client.connect(): | |
print(await client.call('hello', 'World')) | |
logging.basicConfig(level=logging.DEBUG) | |
client = TrioWAMPClient('ws://localhost:8080/', 'realm1') | |
trio.run(main) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment