Skip to content

Instantly share code, notes, and snippets.

@agronholm
Created September 27, 2017 21:46
Show Gist options
  • Save agronholm/86ad21955c192ef124531df253ad3738 to your computer and use it in GitHub Desktop.
Save agronholm/86ad21955c192ef124531df253ad3738 to your computer and use it in GitHub Desktop.
Sample trio WAMP applications
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
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