def public_broadcaster():
while __websocket_server_running__:<EOL><INDENT>pipein = open(PUBLIC_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>WebSocketHandler.broadcast(line)<EOL>print(line)<EOL>remaining_lines = pipein.read()<EOL>pipein.close()<EOL>pipeout = open(PUBLIC_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 public pipe and broadcasts them publicly to all connected clients.