loopback with socket.io and socket.io-redis seems not really work on cluster
By using socket.io-redis, but seems not really work. Do I need nginx/haproxy or anything more? Many thanks.
...
if (require.main === module) {
app.io = require('socket.io')(app.start());
var redis = require('socket.io-redis');
app.io.adapter(redis({ host: 'localhost', port: 6379 }));
...
Or how do I use strong-cluster-socket.io-store after app.start()?
app.io = require('socket.io')(app.start());
???
My solution: Set client socket.io transports to 'websocket'.
var socket = io(ENV.BASE_URL, {
transports: [ 'websocket' ]
});
:+1: same problem here @makersu
Didn't you end up with a server side solution?
Define transport types on the client side: server:
app.sio = require('socket.io')(app.start());
var redis = require('socket.io-redis');
app.sio.adapter(redis({ host: 'localhost', port: 6379 }));
client: index.html
<script src="lib/socket.io-client/socket.io.js"></script>
client: angular
function LBSocket($rootScope, ENV, User) {
...
var socket = io(ENV.BASE_URL, {
transports: [ 'websocket' ]
});
Or maybe you can reference: https://github.com/btford/angular-socket-io
Closing this issue as it has been resolved. If you are still running into problems, feel free to leave a comment and I will reopen the issue.