This commit is contained in:
Andros Fenollosa 2017-11-07 00:15:37 +01:00
parent ffb8f26efb
commit a0849ce1b2
3 changed files with 3 additions and 2 deletions

2
app.py
View File

@ -39,7 +39,7 @@ def open_chat(channel, name):
@socketio.on('new_message')
def new_message(message):
# Send message to alls users
emit('new_message', {
emit('channel-' + str(message['channel']), {
'username': message['username'],
'text': message['text']
},

View File

@ -1,3 +1,4 @@
SECRET_KEY=secret
DEBUG=True
DATABASE="sqlite:///database.sqlite"
DOMAIN=127.0.0.1:5000

View File

@ -72,7 +72,7 @@
console.log('Connect')
});
socket.on('new_message', function(msg) {
socket.on('channel-' + app.channel, function(msg) {
// Add new message to HTML
let my_messages = app.messages;
my_messages.push({