-
Notifications
You must be signed in to change notification settings - Fork 3
/
message.py
23 lines (21 loc) · 861 Bytes
/
message.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import stomp
import urllib
import time
def sendMessageToSmartBody(cmd):
try:
conn = stomp.Connection()#comment this line
#conn.start()
conn.connect('admin', 'password', wait=True)
body = cmd
message = urllib.quote_plus(body)
hdrs = {}
hdrs['ELVISH_SCOPE'] = 'DEFAULT_SCOPE'
hdrs['MESSAGE_PREFIX'] = 'sbm'
conn.auto_content_length= False
conn.send(body=message, headers=hdrs, destination='/topic/DEFAULT_SCOPE')
#time.sleep(0.040)
#conn.disconnect()#comment this line
except Exception as e:
print e.message
#sendMessageToSmartBody("sb scene.getDiphoneManager().setPhonemesRealtime('foo', 'oo')")
#sendMessageToSmartBody("sb print x")