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 { //消息路由过来但是本地没有对应的连接 } }
public Task HandleCrossServerMessage(CrossServerMessageContext context) { throw new NotImplementedException(); }
public async Task HandleCrossServerMessage(CrossServerMessageContext context) { var tasks = context.Server.ClientManager.AllConnections().Select(x => x.SendMessage(context.Message)).ToArray(); await Task.WhenAll(tasks); }