diff --git a/.DS_Store b/.DS_Store index e2fb3cb..f2f9daa 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/app/views.py b/app/views.py index 77d0cca..40bbceb 100755 --- a/app/views.py +++ b/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()