Closed dottodot closed 6 years ago
What does it show when running the application with the DEBUG=feathers-sync
environment variable?
On the first hit to the site I got
2018-05-01T07:50:36.793847Z app[web.cluster2-27b0a9a1-59e1-4c2f-ab4c-a29009b041b7]: 2018-05-01T07:50:36.793Z feathers-sync Sending sync-out event 'authentication created'
2018-05-01T07:50:36.804535Z app[web.cluster1-7e7974e4-2e7b-4f4a-bdf9-dbde4f42e2c8]: 2018-05-01T07:50:36.804Z feathers-sync Dispatching sync-in event 'authentication created'
2018-05-01T07:50:36.806649Z app[web.cluster3-93d16b00-09cd-42b7-b2dd-ef0ddd361c20]: 2018-05-01T07:50:36.806Z feathers-sync Dispatching sync-in event 'authentication created'
2018-05-01T07:50:36.805525Z app[web.cluster2-27b0a9a1-59e1-4c2f-ab4c-a29009b041b7]: 2018-05-01T07:50:36.805Z feathers-sync Dispatching sync-in event 'authentication created'
then on a refresh I got
2018-05-01T07:51:06.769989Z app[web.cluster2-27b0a9a1-59e1-4c2f-ab4c-a29009b041b7]: 2018-05-01T07:51:06.769Z feathers-sync Sending sync-out event 'authentication removed'
2018-05-01T07:51:06.775527Z app[web.cluster3-93d16b00-09cd-42b7-b2dd-ef0ddd361c20]: 2018-05-01T07:51:06.775Z feathers-sync Dispatching sync-in event 'authentication removed'
2018-05-01T07:51:06.773676Z app[web.cluster1-7e7974e4-2e7b-4f4a-bdf9-dbde4f42e2c8]: 2018-05-01T07:51:06.773Z feathers-sync Dispatching sync-in event 'authentication removed'
2018-05-01T07:51:06.774329Z app[web.cluster2-27b0a9a1-59e1-4c2f-ab4c-a29009b041b7]: 2018-05-01T07:51:06.774Z feathers-sync Dispatching sync-in event 'authentication removed'
Managed to resolve the issue by using io({transports: ['websocket'], upgrade: false});
Basically the same as the issue reported here https://github.com/feathersjs-ecosystem/feathers-sync/issues/55
Ooooh.... I bet it's because the default polling goes through the load balancer and the connection ends up on the wrong server. Should definitely be mentioned as a caveat then. I'm wondering if it also should be set to websockets only in the generated application. There are many issue with the none-websocket fallbacks and all supported browsers and React Native support websockets without problems.
I now have another issue on the same setup. When trying to connect to my feathers app from another express app using socketio-client
it just times out. If I scale my feathers app back to a single server it's fine.
For newer feathers, on the server:
app.configure(socketio({
transports: ['websocket']
}));
On a single server I can see it populating events in my mongodb but as soon as I scale to 3 servers it stops working and I get socket connection errors such as