def private_messenger():
while __websocket_server_running__:<EOL><INDENT>pipein = open(PRIVATE_PIPE, '<STR_LIT:r>')<EOL>line = pipein.readline().replace('<STR_LIT:\n>', '<STR_LIT>').replace('<STR_LIT:\r>', '<STR_LIT>')<EOL>if line != '<STR_LIT>':<EOL><INDENT>message = json.loads(line)<EOL>WebSocketHandler.send_private_message(user_id=message['<STR_LIT>'],<EOL>message=message)<EOL>print(line)<EOL>remaining_lines = pipein.read()<EOL>pipein.close()<EOL>pipeout = open(PRIVATE_PIPE, '<STR_LIT:w>')<EOL>pipeout.write(remaining_lines)<EOL>pipeout.close()<EOL><DEDENT>else:<EOL><INDENT>pipein.close()<EOL><DEDENT>time.sleep(<NUM_LIT>)<EOL><DEDENT>
Thread which runs in parallel and constantly checks for new messages
in the private pipe and sends them to the specific client.
If client is not connected the message is discarded.