Building Real-Time Web Applications With Cettia, Part 2

Welcome back! If you missed Part 1, you can check it out here.
Broadcasting Events
To send an event to multiple sockets, you could create a set, add a socket to the set, and send events iterating over the set. It should work, but the socket is stateful and not serializable, which means that the caller should always check whether this socket is available each time; it’s not possible to handle this socket on the other side of the wire. Cettia resolved these issues in a functional way.