public void Connect()
        {
            const string APPLICATION_NAME = "Empty";

            var serverAddress = serverConnectionInformation.Ip + ":" + serverConnectionInformation.Port;
            var isConnecting  = RawPeer.Connect(serverAddress, APPLICATION_NAME);

            LogUtils.Assert(isConnecting, new TraceMessage("Could not begin connection with: " + serverAddress + " <" + APPLICATION_NAME + ">"));
        }
        private void Update()
        {
            do
            {
                // Left blank intentionally
            } while (RawPeer.DispatchIncomingCommands());

            do
            {
                // Left blank intentionally
            } while (RawPeer.SendOutgoingCommands());
        }
        public void Disconnect()
        {
            if (RawPeer.PeerState == PeerStateValue.Disconnected ||
                RawPeer.PeerState == PeerStateValue.Disconnecting)
            {
                return;
            }

            RawPeer.Disconnect();
            RawPeer.StopThread();

            Disconnected?.Invoke(DisconnectReason.ClientDisconnect, null);
        }
        public short Send <TParam>(MessageData <TParam> data, MessageSendOptions sendOptions)
            where TParam : struct, IParameters
        {
            if (sendOptions.Flush)
            {
                LogUtils.Log(MessageBuilder.Trace("sendOptions::Flush is not supported!"), LogMessageType.Warning);
            }

            var currentRequestId = requestId++;
            var operationRequest = Utils.ToPhotonOperationRequest(data, currentRequestId);

            var result = RawPeer.OpCustom(operationRequest, sendOptions.Reliable, sendOptions.ChannelId, sendOptions.Encrypted);

            LogUtils.Assert(result, "Could not send operation request");
            return(currentRequestId);
        }