'Write data over the event socket if it\'s open.'

def write_data(self, message):

    try:
        message_str = json.dumps(message)
    except UnicodeDecodeError:
        message_str = json.dumps(fix_unicode_dict(message))
    if (len(self.events_requests) == 0):
        return
    else:
        [request.write((message_str + '\n')) for request in self.events_requests]
