<s> from flask import session <EOL> from flask . ext . socketio import emit , join_room , leave_room <EOL> from . . import socketio <EOL> @ socketio . on ( '<STR_LIT>' , namespace = '<STR_LIT>' ) <EOL> def joined ( message ) : <EOL> """<STR_LIT>""" <EOL> room = session . get ( '<STR_LIT>' ) <EOL> join_room ( room ) <EOL> emit ( '<STR_LIT:status>' , { '<STR_LIT>' : session . get ( '<STR_LIT:name>' ) + '<STR_LIT>' } , room = room ) <EOL> @ socketio . on ( '<STR_LIT:text>' , namespace = '<STR_LIT>' ) <EOL> def left ( message ) : <EOL> """<STR_LIT>""" <EOL> room = session . get ( '<STR_LIT>' ) <EOL> emit ( '<STR_LIT:message>' , { '<STR_LIT>' : session . get ( '<STR_LIT:name>' ) + '<STR_LIT::>' + message [ '<STR_LIT>' ] } , room = room ) <EOL> @ socketio . on ( '<STR_LIT:left>' , namespace = '<STR_LIT>' ) <EOL> def left ( message ) : <EOL> """<STR_LIT>""" <EOL> room = session . get ( '<STR_LIT>' ) <EOL> leave_room ( room ) <EOL> emit ( '<STR_LIT:status>' , { '<STR_LIT>' : session . get ( '<STR_LIT:name>' ) + '<STR_LIT>' } , room = room ) </s>
