TsgcWebSocketClient › Events › OnMessage
Fires every time the server sends a text message to the client.
public event TsgcWSMessageEventHandler OnMessage;
// delegate void TsgcWSMessageEventHandler(TsgcWSConnection Connection, string Text)
—
OnMessage is raised once a complete text frame has been received from the server. The Text parameter carries the decoded UTF-8 string; the Connection parameter identifies the session on which the message arrived. By default NotifyEvents is neAsynchronous, so the handler runs in the context of the main thread and it is safe to update UI controls directly; switch to neNoSync if the client receives a high volume of messages and you prefer to handle synchronization yourself. If Options.FragmentedMessages is frgOnlyFragmented this event is not raised and the payload is delivered through OnFragmented instead.
void OnMessage(TsgcWSConnection Connection, string Text)
{
MessageBox.Show("Message Received from Server: " + Text);
}