Skip to content
Snippets Groups Projects
Commit 788ae21b authored by Ravi Tripathi's avatar Ravi Tripathi
Browse files

modify the message_queue in socketio app

parent 35310b0e
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,6 @@ import time
import signal
import tasks
from flask import session
from flask_socketio import SocketIO, join_room
......@@ -14,8 +13,9 @@ from app import create_app
config_name = os.getenv('FLASK_CONFIG')
app = create_app(config_name)
app.config['SECRET_KEY'] = 'vnkdjnfjknfl1232#'
socketio = SocketIO(app, message_queue='amqp://reggie:reggie@ohpc:5672/socketio')
#socketio = SocketIO(app)
#socketio = SocketIO(app, message_queue='amqp:///socketio')
socketio = SocketIO(app)
# global username_global
# global room_global
......@@ -55,13 +55,15 @@ def user_connected(json, methods=['GET', 'POST']):
@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))
print(json)
#print(json)
room = str(session['uid'])
join_room(room)
print("Room: {}".format(room))
#socketio.emit("creating account")
try:
# create_account(json['username'], json['fullname'], json['reason'])
tasks.celery_create_account(json['username'], json['fullname'], json['reason'], room, socketio)
#tasks.celery_create_account.delay(json['username'], json['fullname'], json['reason'], room, socketio, session=room)
tasks.celery_create_account.delay(json['username'], json['fullname'], json['reason'], room)
except Exception as e:
print(time.strftime("%m-%d-%Y_%H:%M:%S") + "\tError in account creation: ", e)
socketio.emit("Account creation failed", room)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment