The Interfaces Provided by the Connection Class
In Workerman, there are two important classes: Worker and Connection.
Each client connection corresponds to a Connection object, which allows for setting callbacks such as onMessage, onClose, etc. It also provides an interface for sending data to the client via the send method and for closing the connection through the close method, as well as some other necessary interfaces.
It can be said that Worker is a listening container, responsible for accepting client connections and wrapping those connections into Connection objects for developers to manipulate.