Number of websockets currently opened

29 views
Skip to first unread message

Florian Pradines

unread,
Jan 12, 2018, 9:34:37 AM1/12/18
to Play Framework
Hi,

I wonder, if there is a native way to know how many websockets are opened at a given instant?

Thanks,

Will Sargent

unread,
Jan 16, 2018, 7:23:20 PM1/16/18
to play-fr...@googlegroups.com
That's an interesting question.  You can count the number of active streams that you get out, and expose that as a metric:


--
You received this message because you are subscribed to the Google Groups "Play Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/cf962ec3-6309-46e7-b1ff-30ac55c6cf61%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Igmar Palsenberg

unread,
Jan 17, 2018, 5:02:06 AM1/17/18
to Play Framework

I wonder, if there is a native way to know how many websockets are opened at a given instant?

Not out of the box, no. I created an Actor per JVM that received a message when the webstream actor was created, and another message on when it terminated.
Not sure how to handle this when using streams however.


Igmar 

Florian Pradines

unread,
Jan 20, 2018, 8:38:19 AM1/20/18
to Play Framework
Thanks for all of your answers. I finally used the same method as Igmar but with an AtomicInteger to keep the count.
Reply all
Reply to author
Forward
0 new messages