private bool Deserialize <T>(string objectType, string input, out RelayIncomingEvent incomingEvent) where T : RelayIncomingEvent
        {
            if (objectType == typeof(T).Name)
            {
                incomingEvent = JsonUtility.FromJson <T>(input);
                return(true);
            }

            incomingEvent = null;
            return(false);
        }
Example #2
0
        private void DispatchEvent(RelayIncomingEvent incomingEvent)
        {
            if (incomingEvent is TransactionResult)
            {
                _transactionManager.HandleTransactionResult((TransactionResult)incomingEvent);
                return;
            }

            var clientEvent = incomingEvent as ClientIncomingEvent;

            if (clientEvent == null)
            {
                _eventHandler.OnWarning(new RelayException(RelayErrorCode.UnknownEvent), $"Ignored incoming unknown event of type {incomingEvent}");
                return;
            }

            DispatchMasterDisconnected(clientEvent as MasterDisconnected);
            DispatchClientMessage(clientEvent as MessageToClient);
        }
Example #3
0
        private void DispatchEvent(RelayIncomingEvent incomingEvent)
        {
            if (incomingEvent is TransactionResult)
            {
                _transactionManager.HandleTransactionResult((TransactionResult)incomingEvent);
                return;
            }

            var masterEvent = incomingEvent as MasterIncomingEvent;

            if (masterEvent == null)
            {
                _eventHandler.OnWarning(new RelayException(RelayErrorCode.UnknownEvent), $"Ignored incoming unknown event of type {incomingEvent}");
                return;
            }

            DispatchClientDisconnected(masterEvent as ClientDisconnected);
            DispatchClientConnected(masterEvent as ClientJoined);
            DispatchClientMessage(masterEvent as N.Package.Relay.Events.Master.In.MessageFromClient);
        }