Skip to content

WebSockets\Message

AlMA PRO LEADER edited this page Oct 19, 2018 · 2 revisions

WebSockets\Message Class

This class implements \Ratchet\MessageComponentInterface which creates four functions: onOpen, onMessage, onClose & onError.

Functions

onOpen

This function is called with every new client and then calls \APLib\WebSockets::add function to add the client to the active clients' list.

onMessage

This function is called when ever a client sends a message and then passes the client along with the message received to \APLib\WebSockets::respond function.

onClose

This function is called when ever a client closes the connection and then passes the client to \APLib\WebSockets::remove function to be removed from the active clients' list.

onError

This function is called when ever a connection error happens and closes the connection with the client that caused it.

Clone this wiki locally