Fixing username
This commit is contained in:
@ -112,7 +112,7 @@ class PusherWebsocketHandler(tornado.websocket.WebSocketHandler):
|
||||
logger.info( 'Pusher connection established: '+ connectionid +' ('+ clientid +'/'+ username +')' )
|
||||
|
||||
# broadcast to all connections that a new user has connected
|
||||
broadcast( 'client_connected', client )
|
||||
broadcast( 'new_connection', client )
|
||||
|
||||
def select_subprotocol(self, subprotocols):
|
||||
# select one of our subprotocol elements and return it. This confirms the connection has been accepted.
|
||||
@ -217,7 +217,7 @@ class PusherWebsocketHandler(tornado.websocket.WebSocketHandler):
|
||||
)
|
||||
|
||||
# notify all clients of this change
|
||||
broadcast( 'connection_updated', { 'connections': connections[messageJson['origin']['connectionid']]['client'] })
|
||||
broadcast( 'connection_updated', { 'connection': connections[messageJson['origin']['connectionid']]['client'] })
|
||||
|
||||
# start radio
|
||||
elif messageJson['action'] == 'start_radio':
|
||||
|
||||
@ -120,17 +120,17 @@ const PusherMiddleware = (function(){
|
||||
request({ action: 'get_version' })
|
||||
.then(
|
||||
response => {
|
||||
store.dispatch({ type: 'PUSHER_VERSION', data: response.data })
|
||||
store.dispatch({ type: 'VERSION', data: response.data })
|
||||
}
|
||||
)
|
||||
return next(action);
|
||||
break;
|
||||
|
||||
case 'PUSHER_UPGRADING':
|
||||
case 'UPGRADING':
|
||||
request({ action: 'perform_upgrade' })
|
||||
.then(
|
||||
response => {
|
||||
store.dispatch({ type: 'PUSHER_UPGRADE', data: response.data })
|
||||
store.dispatch({ type: 'UPGRADE', data: response.data })
|
||||
}
|
||||
)
|
||||
return next(action);
|
||||
@ -139,19 +139,19 @@ const PusherMiddleware = (function(){
|
||||
case 'PUSHER_SET_USERNAME':
|
||||
request({ action: 'set_username', username: action.username })
|
||||
.then(
|
||||
response => {
|
||||
response => {
|
||||
store.dispatch({ type: 'PUSHER_USERNAME', data: { username: response.data.username }})
|
||||
}
|
||||
)
|
||||
return next(action);
|
||||
break;
|
||||
|
||||
case 'PUSHER_GET_CONNECTIONS':
|
||||
case 'PUSHER_CLIENT_CONNECTED':
|
||||
case 'GET_CONNECTIONS':
|
||||
case 'NEW_CONNECTION':
|
||||
request({ action: 'get_connections' })
|
||||
.then(
|
||||
response => {
|
||||
store.dispatch({ type: 'PUSHER_CONNECTIONS', data: response.data })
|
||||
store.dispatch({ type: 'CONNECTIONS', data: response.data })
|
||||
}
|
||||
)
|
||||
return next(action);
|
||||
|
||||
@ -23,27 +23,27 @@ export default function reducer(pusher = {}, action){
|
||||
case 'PUSHER_USERNAME':
|
||||
return Object.assign({}, pusher, { username: action.data.username });
|
||||
|
||||
case 'PUSHER_CONNECTIONS':
|
||||
case 'CONNECTIONS':
|
||||
return Object.assign({}, pusher, { connections: action.data.connections });
|
||||
|
||||
case 'PUSHER_CONNECTION_UPDATED':
|
||||
case 'CONNECTION_UPDATED':
|
||||
function byID(connection){
|
||||
return connection.connectionid == action.data.connections.connectionid;
|
||||
return connection.connectionid == action.data.connection.connectionid;
|
||||
}
|
||||
var connection = pusher.connections.find(byID);
|
||||
var index = pusher.connections.indexOf(connection);
|
||||
var connections = Object.assign([], pusher.connections);
|
||||
connections[index] = action.data.connections;
|
||||
connections[index] = action.data.connection;
|
||||
|
||||
return Object.assign({}, pusher, { connections: connections });
|
||||
|
||||
case 'PUSHER_VERSION':
|
||||
case 'VERSION':
|
||||
return Object.assign({}, pusher, {
|
||||
version: action.data.version,
|
||||
upgrading: false
|
||||
});
|
||||
|
||||
case 'PUSHER_UPGRADING':
|
||||
case 'UPGRADING':
|
||||
return Object.assign({}, pusher, { upgrading: true });
|
||||
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user