Sajit Gupta
Sajit Gupta

Reputation: 108

Session in Lagom

How can we manage session in Lagom and share data across multiple service calls using Session ?

Basically I want to store a userId on account creation across multiple requests. I want to store this userId in a session. How can we do this in Lagom?

Upvotes: 0

Views: 103

Answers (1)

Qwertycrackers
Qwertycrackers

Reputation: 666

Although what you are asking for is possible, and would likely be achieved by passing some sessionID to your frontend and then passing it back with each request, this would violate the principle of a "stateless service" and is probably bad practice.

Instead of maintaining user sessions on the backend, try to maintain all session-state on the client side, and have the client frontend interact with the backend only by means of RESTful calls. This will save you enourmous struggle later, when you want to scale your service and realize that tracking all the session IDs across clustered deployments of your service is a nightmare.

Upvotes: 1

Related Questions