Esempio n. 1
0
        public Task <bool> TryHandleMessage(HubConnectionMessageContext <TRemoteClientHubInterfaceType> context, NetworkIncomingMessage <BaseSocialModel> message)
        {
            if (CanHandle(message))
            {
                return(MessageRouteMap[message.Payload.GetType()].TryHandleMessage(context, message));
            }

            if (Logger.IsEnabled(LogLevel.Error))
            {
                Logger.LogError($"Unable to handle Social Model of Type: {message.Payload.GetType().Name}");
            }

            return(Task.FromResult(false));
        }
Esempio n. 2
0
        public async Task <bool> TryHandleMessage([JetBrains.Annotations.NotNull] HubConnectionMessageContext <TRemoteClientHubInterfaceType> context, [JetBrains.Annotations.NotNull] NetworkIncomingMessage <BaseSocialModel> message)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            if (CanHandle(message))
            {
                await HandleMessage(context, (TMessageType)message.Payload);

                return(true);
            }

            return(false);
        }
Esempio n. 3
0
 public Task HandleMessage(HubConnectionMessageContext <TRemoteClientHubInterfaceType> context, TMessageType payload)
 {
     //We just forward the message to handling and expose ONLY the hub connection message context interface
     //so that nobody calls the GladNet3 stuff.
     return(OnMessageRecieved(context, payload));
 }