worker_id = pkt.sender_id
assignment_id = pkt.assignment_id
curr_state = self.worker_state[worker_id].assignments[assignment_id]
if not curr_state.is_final():
// Push the message to the message thread to send on a reconnect
curr_state.messages.append(pkt.data)
// Clear the send message command, as a message was recieved
curr_state.last_command = None
self.mturk_agents[worker_id][assignment_id].msg_queue.put(pkt.data)
def _on_socket_dead(self, worker_id, assignment_id):
Handle a disconnect event, update state as required and notifying