예제 #1
0
        public async Task HandleCrossServerMessage(CrossServerMessageContext context)
        {
            var payload = context.Server.MessageSerializer.Deserialize <UserToUserPayload>(context.Message.Payload);
            var tasks   = context.Server.ClientManager.AllConnections()
                          .Where(x => x.Client.SubjectID == payload.Reciever)
                          .Select(x => x.SendMessage(context.Message)).ToArray();

            if (tasks.Any())
            {
                await Task.WhenAll(tasks);
            }
            else
            {
                //消息路由过来但是本地没有对应的连接
            }
        }
예제 #2
0
 public Task HandleCrossServerMessage(CrossServerMessageContext context)
 {
     throw new NotImplementedException();
 }
예제 #3
0
 public async Task HandleCrossServerMessage(CrossServerMessageContext context)
 {
     var tasks = context.Server.ClientManager.AllConnections().Select(x => x.SendMessage(context.Message)).ToArray();
     await Task.WhenAll(tasks);
 }