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