java - Running a continuous background task in Play 2.4.2 server -


i'm creating web application displays incoming events strings onto web browser. events should coming in listener have defined in part of program. these events emitted through socket client side.

the problem: need keep listener continually running in order receive messages. listener 1 block of code that's listener.run(), , doesn't terminate. right now, making separate thread runs block of code , have configured global settings run thread on application startup.

i don't want task stop , start every time refresh page. how can make listener run right when server starts?

look @ scheduling asynchronous tasks @ end of doc: https://www.playframework.com/documentation/2.4.x/javaakka


Comments