Browse Source

updates

ansible-setup-and-deploy
Alex 6 years ago
parent
commit
bdd5ac3ddc
  1. BIN
      .DS_Store
  2. 9
      app/views.py

BIN
.DS_Store

Binary file not shown.

9
app/views.py

@ -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