master
Alex 6 years ago
parent 85a1298e63
commit bdd5ac3ddc

BIN
.DS_Store vendored

Binary file not shown.

@ -379,10 +379,14 @@ def page_not_found(error):
"""Custom 404 page."""
return render_template('404.html'), 404
### SOCKET for the chat
@socketio.on('new_message')
def new_message(message):
# Send message to alls users
print("new message")
# Send message to all users
# print("new message")
# channel is always 1 now, but might be interesting for further development
emit('channel-' + str(message['channel']), {
'username': message['username'],
'text': message['text'],
@ -394,6 +398,7 @@ def new_message(message):
my_new_chat = Chat(
message=message['text']
)
db.session.add(my_new_chat)
try:
db.session.commit()

Loading…
Cancel
Save