-
-
Notifications
You must be signed in to change notification settings - Fork 751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
login event emit twice for same user using socket.io #1174
Comments
This is a confirmed bug, originally reported in feathersjs-ecosystem/authentication#673. Keeping this one open to track things here. |
@daffl , I noticed that this happens because of socket transport upgrade from polling to websocket that's when you will see two login events. another thing i noticed that if i run feathers server and client locally than i don't see two login event i.e in same local network; if i put client and server apart via internet than only i see two login events that's may be because of network latency. I figured two possible workaround for this to prevent two login events.
I've right now used transport in revers order i.e. fallback approach; so i'm not getting two login events. |
Could this be related to why I keep getting an error of |
Thanks for digging into this @vinaykharecha. I'll verify that this is no longer happening for Authentication v3 (#1045) |
@vinaykharecha where you changed order of transports? Thanks! |
Order of transports needs to be changed on client side not server side. const feathers = require('@feathersjs/feathers');
const socketio = require('@feathersjs/socketio-client');
const io = require('socket.io-client');
const app = feathers();
const socket = io("https://feathers.domain.com", {
transports: ['websocket','polling'],
forceNew: true
});
app.configure(socketio(socket)); |
@vinaykharecha thanks you! 😄 |
Closing since this should no longer be happening in Feathers v4 authentication. See the Migration guide for more information on how to upgrade. |
@daffl new version? 😱 |
I have this problem again and I use v4. Results of connection: |
Steps to reproduce
setup authentication using feather-client(socket.io) and add login event to feather api-server(setup feather server using feather express and socket modules).
when the user authenticates from UI, feather emits the login event twice for the same user.
Expected behavior
it should emit one login event when the same user authenticates from UI.
Actual behavior
when user login through app feather server emits login event twice for the same user.
System configuration
Tell us about the applicable parts of your setup.
Module versions (especially the part that's not working):
feather server:
"@feathersjs/authentication": "2.1.6",
"@feathersjs/authentication-jwt": "2.0.1",
"@feathersjs/authentication-local": "1.2.1",
"@feathersjs/configuration": "1.0.2",
"@feathersjs/express": "1.2.2",
"@feathersjs/feathers": "3.2.3",
"@feathersjs/socketio": "3.2.1"
feather-client:
"@feathersjs/client@3.7.6"
NodeJS version:
8.9.3
Operating System:
host: Ubuntu 16.04.5 LTS (x86_64)
container image: alpine:3.7
I know feather socket.io uses pooling transport first after that then it upgrades to web socket transport.
so is there any to prevent the double login event?
your help will be appreciated.
The text was updated successfully, but these errors were encountered: