-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Check if session is not live #8
Comments
Play socket.io offers a stream centric view of socket.io - if the stream is running, the session is alive, if it's not, it's been closed. If you want to maintain that state somewhere, you could use |
Currently what I am doing is very similar to what you mentioned, I use class SocketIOEngine(socketIO: SocketIO , system: ActorSystem, subscriberActor: ActorRef @@ SubscriberActor,
myLagomService: MyLagomService)(implicit mat: Materializer) {
val decoder = decodeByName {
....
}
val encoder = encodeByType {
....
}
def flow(id:String) = {
implicit val timeout = Timeout(1.second)
ActorFlow.actorRef { out =>
DashboardActor.props(id, out, subscriberActor, lagomService)
}(system, mat)
}
val controller: EngineIOController = socketIO.builder
.addNamespace(decoder, encoder){
case (SocketIOSession(sessionId, out),"/chat") => {
flow(sessionId)
}
}
.createController()
} I don't know how well it scales, becasue there is only one actor that keeps track of everything. On the other hand, I am subscribing to bunch of events coming from Lagom Kafka topics in the same actor and send them to the front end actors. |
Let's say we have a session id, how can I check if that session is alive or already has been closed?
The text was updated successfully, but these errors were encountered: