Akka Tcp server with idle connection functionality

I want to implement tcp server with Akka. I want to have idle connection timeout: If client doesn't send anything in some period of time - connection is closed.

How can I implement this? I didn't find any configs or messages in akka.io for this.

Upvotes: 0

Views: 356

Answers (1)

johanandren
johanandren

Reputation: 11479

You can use the receive timeout functionality which is built into all actors in your connection-actor:

context.setReceiveTimeout(10 seconds)

You can read more about it in the manual: http://doc.akka.io/docs/akka/current/scala/actors.html#Receive_timeout

Upvotes: 1

Related Questions