The WebSocket chat example uses a `Collections.syn...
# ktor
m
The WebSocket chat example uses a
Collections.synchronizedSet
but we can't use
synchronize
in suspend functions. I need to send frames to the connected clients from other coroutines. How do I synchronize the access to the data structures of my server and the
DefaultWebSocketServerSession
? Do you use the experimental
Mutex
for this purpose? Is keeping WebSocket connections and broadcasting information to them from other coroutines something ktor designed to do, by the way, or am I just using the wrong tool? Why does the chat examples uses a
Collections.synchronizedSet
but does not synchronize when iterating over the items of the set using
forEach
?