Commit 17966431 authored by Mitchell Moore's avatar Mitchell Moore Committed by Krish Moodbidri
Browse files

Fix variable mixup. Log Room ID to client console

parent 13f7b75e
......@@ -7,6 +7,7 @@
<script src="static/scripts/function.js"></script>
<script>
console.info('Room ID: {{ room_id }}');
var socket = io.connect('http://' + document.domain + ':' + location.port);
socket.on( 'connect', function() {
......
......@@ -16,8 +16,8 @@ app = create_app(config_name)
app.config['SECRET_KEY'] = 'vnkdjnfjknfl1232#'
socketio = SocketIO(app)
global username_global
global room_global
# global username_global
# global room_global
def create_account(username, fullname, reason):
......@@ -31,37 +31,39 @@ def create_account(username, fullname, reason):
def account_agent(*args):
# Todo: Code to create a consumer based on the username goes here
# Todo: Goal is to have it listening for confirmation.
global username_global
print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tAccount successfully created for ' + username_global)
socketio.emit("account ready", room=room_global)
username = session['username']
room = str(session['uid'])
print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tAccount successfully created for ' + username)
socketio.emit("account ready", room=room)
return True
@socketio.on('user connected')
def user_connected(json, methods=['GET', 'POST']):
global username_global
global room_global
username_global = json["user"]
room_global = str(session['uid'])
username = json["user"]
room = str(session['uid'])
join_room(room_global)
join_room(room)
print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tUser ' + username_global + ' connected.')
print('\t\t\t|-----Room ID: ' + room_global)
print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tUser ' + username + ' connected.')
print('\t\t\t|-----Room ID: ' + room)
@socketio.on('request account')
def request_account(json, methods=['GET', 'POST']):
print (time.strftime("%m-%d-%Y_%H:%M:%S") + '\tQueue request received: ' + str(json))
room = str(session['uid'])
try:
# create_account(json['username'], json['fullname'], json['reason'])
tasks.celery_create_account(json['username'], json['fullname'], json['reason'], room_global, socketio)
tasks.celery_create_account(json['username'], json['fullname'], json['reason'], room, socketio)
except Exception as e:
print(time.strftime("%m-%d-%Y_%H:%M:%S") + "\tError in account creation: ", e)
socketio.emit("Account creation failed", room=room_global)
socketio.emit("Account creation failed", room)
if __name__ == '__main__':
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment