NetworkMessage Class for Error

Hey folks,

I’m trying to build a simple chat client / server setup as PoC for an greater networking project.

However, for that im using the NetworkServer simple with following initialisation code:

networkServer = new NetworkServerSimple();
		
networkServer.RegisterHandler (MsgType.Connect, OnClientConnected);
networkServer.RegisterHandler (MsgType.Disconnect, OnClientDisconnected);
networkServer.RegisterHandler (MsgType.Error, OnError);
networkServer.RegisterHandler (ChatID, OnChatMessage);
		
networkServer.Listen(port);
		
Debug.Log("host created:" + networkServer.serverHostId);

The Handler Methods are defined as followed:

private void OnClientConnected(NetworkMessage networkMessage)
	{
		Debug.Log("client connected");
	}

	private void OnClientDisconnected(NetworkMessage networkMessage)
	{
		Debug.Log("client disconnected");
	}

	private void OnError(NetworkMessage networkMessage)
	{
	}

My problem is the OnError-Handler. Each Handler has the NetworkMessage as parameter and I want to read that message in case of an error to display this error in my ui. But for that I need to know what Message the NetworkMessage is so I can read it correctly with

var msg = networkMessage.ReadMessage<???>()

Can anyone tell me the NetworkMessage class of MsgType.Error and maybe of the other two MsgTypes (Connect/Disconnect)?

Thanks in advance,
Patrick

private void OnError(NetworkMessage netMsg)
{
ErrorMessage errorMsg = new ErrorMessage();
errorMsg.Deserialize(netMsg.reader);

    Debug.Log("errorCode =  " + errorMsg.errorCode);
}