Skip to content

Instantly share code, notes, and snippets.

@hiway
Created December 21, 2016 06:02
Show Gist options
  • Save hiway/214ede24e9023b3a5670a9345a592c3b to your computer and use it in GitHub Desktop.
Save hiway/214ede24e9023b3a5670a9345a592c3b to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# coding=utf-8
from zentropi import agent
@agent.on_timer(3)
def say_hello():
agent.emit('hello', data={'name': 'Your Name'})
@agent.on_event('hello')
def on_hello(event):
name = event.data.get('name', 'World')
print('Hello {}!'.format(name))
agent.connect(token='', secret='')
agent.join('test')
agent.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment