- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.py
More file actions
Latest commit
23 lines (15 loc) · 569 Bytes
/
Copy pathexample.py
File metadata and controls
23 lines (15 loc) · 569 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/python
importhookboxclient
defonOpen():
hookbox.subscribe('chat')
defonError(error):
printerror['msg']
defonSubscribed(channelName, subscription):
ifchannelName=='chat':
subscription.onPublish=onChatPublish
subscription.publish("Hey, guys!")
defonChatPublish(frame):
print'[%s] %s: %s'% (frame['datetime'], frame['user'], frame['payload'])
if__name__=='__main__':
hookbox=hookboxclient.HookboxClient(host='akira.hamax.si', port=8002, onOpen=onOpen, onError=onError, onSubscribed=onSubscribed)
hookbox.listen()