I am working on bringing WebSockets functionality to my Grails application. I use Atmosphere Meteor plugin 0.7.1 for this purpose. The workflow is simple:
- User logs in the system.
- User open page with WebSockets functionality
- User clicks a Connect button to establish the connection... and the server doesn't recognize him.
I would like to know which user connected my webSocket.
Usually it's quite easy to detect current user by calling springSecurityService.getPrincipal()
in any controller. I managed to inject springSecurityService
to my MeteorHandler, however it says that the principal is null
. It feels strange for me, as the handler has access to JSESSIONID
cookie, so I expect it to retrieve the correct session data.
Also, request.session
command returns different HttpSession object, compared to the same command performed in regular controller action.
So is there any way to retrieve current logged in user on webSockets connection?
Thanks in advance.