I'm doing a new feature that allow show system logs on admin page. I'm using gevent-socketio (0.3.6). Everything works fine on my local machine but when i deploy my code to EC2, it doesn't work.
Here is client code:
// notification socketio
var socket_notification = io.connect('/notification');
// Update when we get new data from the server
socket_notification.on('data', function (data) {
$scope.notifications.push(data);
$scope.total_noti.push(data);
});
That's what i see in firefox console :
GET http://mybackend.com/socket.io/1/?t=1460013461586 200 OK 466ms
It seems that socket connected successful but i can't get any thing from server.
Here is my backend code:
@route(bp, '/socket.io/<path:remaining>')
def socketio(remaining):
print('connected')
try:
app = current_app._get_current_object()
socketio_manage(request.environ, {'/notification': LiveNotificationNamespace, '/log': LiveLogNamespace}, app)
except:
current_app.logger.error("Exception while handling socketio connection",
exc_info=True)
return Response()
I added a print command to test but it doesn't print any thing. I already updated Varnish config to run websockets through Varnish:
sub vcl_pipe {
if (req.http.upgrade) {
set bereq.http.upgrade = req.http.upgrade;
}
}
sub vcl_recv {
if (req.http.Upgrade ~ "(?i)websocket") {
return (pipe);
}
}
Do i need configure anything on EC2 or something like that?
Thank you.