public NetworkMessage(MessageTypes type, object data, NetworkId senderId, NetworkId messageId, NetworkId responseTo) { MessageType = type; Data = data; SenderId = senderId; MessageId = messageId; ResponseTo = responseTo; }
public void Disconnect(bool sendDisconnectMessage) { if (sendDisconnectMessage) { new NetworkMessage(MessageTypes.Disconnect, null, Id, NetworkId.Generate()).Send(stream); } reading = false; Thread.Sleep(16); stream.Close(); client.Close(); OnDisconnected?.Invoke(this, Id); }
public NetworkMessage(MessageTypes type, object data, NetworkId senderId, NetworkId messageId) : this(type, data, senderId, messageId, NetworkId.Empty) { }