Closed LouisWayne closed 7 years ago
I don't work with user subscription on my project using AngularStomDK, so I didn't have this kind of problem.
Can you do a PR on the project https://github.com/davinkevin/spring-websocket-backend where I use to test the lib and show me the problem ? So I can reproduce the problem and try to implement the solution.
BTW, in your application, do you try to use the settings.autoConnect
provider's param to prevent connection on creation of the service and run the connect
method of the service after the user identification ? This could be a solution...
@davinkevin , thanks for the reply.
I figured out that the issue is from Spring security. Since it re-assigns the session after signing in, the websocket doesn't really know the session has been changed. There are 2 solutions: 1st one is that using a token as authentication so that the session never recreated. 2nd solution is that keep the session info using REDIS (or something). Since the problem is not from your library, I am going to close the ticket. I love the library, simple to use - thanks again!
By the way, I was testing the method: convertAndSendToUser()
I am using Spring Framework, and trying to subscribe 'user' specific notification. Here is the code from JS:
After sign-in process, the client will run the below script
But from the server-side, it fails to get the current logged-in user.
When I refresh the page, sessionSubscribeEvent.getUser() gets the current user properly.
Do I need to write special logic since it's subscription for specific user (i.e. header information)? Please advice...!