https://kotlinlang.org logo
#javalin
Title
# javalin
t

tipsy

04/06/2019, 6:59 AM
Jetty handles all of that. According to this post it used the same threadpool as http handlers, but it's not a 1 to 1 mapping: https://stackoverflow.com/questions/29307949/determine-maximum-websockets-jetty-will-open
a

asad.awadia

04/06/2019, 1:23 PM
So is launching threads via
thread {...}
in javalin websockets app good or bad?
I have a shared mutable state which worries me slightly
Its a ‘game’ object that players are getting- and it’s ‘time left’ property needs to be decremented by 1 every second
Not sure how to structure this
t

tipsy

04/06/2019, 4:01 PM
it shouldn't be necessary to launch new threads
just call
send
and let jetty deal with it
there's also
sendFuture
if you need async
2 Views