def chat_message(g): if g.get('msg') and current_user.is_authenticated: message = { 'user': current_user.name, 'msg': escape_html(g.get('msg')[:250]) } rconn.lpush('chathistory', json.dumps(message)) rconn.ltrim('chathistory', 0, 20) socketio.emit('msg', message, namespace='/snt', room='chat')
def chat_message(g): if g.get("msg") and current_user.is_authenticated: message = { "user": current_user.name, "msg": escape_html(g.get("msg")[:250]) } rconn.lpush("chathistory", json.dumps(message)) rconn.ltrim("chathistory", 0, 20) socketio.emit("msg", message, namespace="/snt", room="chat")