I'm trying to setup my Flask app to use RabbitMQ as a message queue. It works fine if I emit messages from the server but if I try to emit messages nothing happens. It seems like the front end socket is not communicating with the queue.
My socket code looks as follows:
from flask_socketio import emit, SocketIO
socketio_mp = SocketIO(message_queue='amqp://guest:guest@localhost:5672//')
@socketio_mp.on('connected', namespace='/test')
def joined():
"""Sent by clients when they enter a room.
A status message is broadcast to all people in the room."""
print('connected')
The socket is initialized correctly as shown in the Flask-SocketIO docs. The connected
event is never triggered even though it is emitted from the front end.
var namespace = "/test";
socket = io.connect(location.protocol + "//" + document.domain + ":" + location.port + namespace);
socket.on("connect", function() {
console.log("connected");
socket.emit("connected", {msg: "next"});
});
I also get no errors in the console.