Skip to content

Commit

Permalink
Send the most minimal body for connecting in produce.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Dahan committed Nov 30, 2011
1 parent 46110f1 commit 25e5e23
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions produce.py
Expand Up @@ -32,11 +32,8 @@ def produce(hostname, api_key, swarm_id, resource_id, wrap):
#Sleep required to allow the swarm server time to respond with header #Sleep required to allow the swarm server time to respond with header
time.sleep(1) time.sleep(1)


#Send a blank message to open the connection #Send a blank http body to open the connection
stripped_msg = '{"message": {"to": ["' + swarm_id + '"], "payload":}}' conn.send('2\r\n\n\n\r\n')
size = hex(len(stripped_msg))[2:] + "\r\n"
chunk = stripped_msg + "\r\n"
conn.send(size+chunk)


#Execute further messages #Execute further messages
if wrap == False: if wrap == False:
Expand Down

0 comments on commit 25e5e23

Please sign in to comment.