TsgcWebSocketServer › Events › OnMessage
Fires every time a client sends a text message and it is received by the server.
public event TsgcWSMessageEventHandler OnMessage;
// delegate void TsgcWSMessageEventHandler(TsgcWSConnection Connection, string Text)
—
OnMessage is raised once a complete text frame has been received from a client. The Text parameter carries the decoded UTF-8 string and the Connection parameter identifies the sender session, so the handler can reply on the same connection or relay the message to other clients. By default NotifyEvents is neAsynchronous and the handler runs synchronized with the main thread, which makes it safe to update UI controls; for high-throughput servers set NotifyEvents to neNoSync to dispatch in the connection thread and implement your own synchronization. If Options.FragmentedMessages is frgOnlyFragmented the event is not raised and the payload is delivered through OnFragmented instead.
void OnMessage(TsgcWSConnection Connection, string Text)
{
MessageBox.Show("Message Received from Client: " + Text);
}