Allow override of connection_id in messages

This commit is contained in:
James Barnsley
2017-06-13 11:56:20 +12:00
parent 164d8ecbeb
commit 2535725d44
3 changed files with 6 additions and 1 deletions

View File

@ -144,6 +144,7 @@ class IrisCore(object):
})
return {
'status': 1,
'connection_id': connection_id,
'username': data['username']
}

View File

@ -71,7 +71,10 @@ class WebsocketHandler(tornado.websocket.WebSocketHandler):
else:
data = {}
data['connection_id'] = self.connection_id
# Handle hard-coded connection_id in messages
# Otherwise include the origin connection of this message
if 'connection_id' not in data:
data['connection_id'] = self.connection_id
if 'request_id' in message:
request_id = message['request_id']

View File

@ -162,6 +162,7 @@ class Debug extends React.Component{
<option value='{"method":"get_queue_metadata"}'>Get queue metadata</option>
<option value='{"method":"broadcast","data":{"type":"browser_notification","title":"Testing","body":"This is my message"}}'>Broadcast to all clients</option>
<option value='{"method":"deliver_message","data":{"to":"CONNECTION_ID_HERE","message":{"type":"browser_notification","title":"Testing","body":"This is my message"}}}'>Broadcast to one client</option>
<option value='{"method":"set_username","data":{"connection_id":"CONNECTION_ID_HERE","username":"NewUsername"}}}'>Change username</option>
<option value='{"method":"refresh_spotify_token"}'>Refresh Spotify token</option>
<option value='{"method":"perform_upgrade"}'>Perform upgrade (beta)</option>
</select>