public static Task LeaveGroup( [HttpTrigger(AuthorizationLevel.Anonymous, "post")] LeaveGroupMessage leaveGroupMessage, [SignalR(HubName = "chat")] IAsyncCollector <SignalRGroupAction> signalRGroupActions, ILogger log) { return(signalRGroupActions.AddAsync( new SignalRGroupAction { UserId = leaveGroupMessage.userId, GroupName = leaveGroupMessage.groupId, Action = GroupAction.Remove })); }
public override Task RemoveFromGroupAsync(string connectionId, string groupName, CancellationToken cancellationToken = default) { if (IsInvalidArgument(connectionId) || IsInvalidArgument(groupName)) { return(Task.CompletedTask); } var message = new LeaveGroupMessage(connectionId, groupName); // Send this message from a fixed service connection, so that message order can be reserved. return(_serviceConnectionManager.WriteAsync(groupName, message)); }
public override Task RemoveFromGroupAsync(string connectionId, string groupName, CancellationToken cancellationToken = default) { if (IsInvalidArgument(connectionId)) { throw new ArgumentException(NullOrEmptyStringErrorMessage, nameof(connectionId)); } if (IsInvalidArgument(groupName)) { throw new ArgumentException(NullOrEmptyStringErrorMessage, nameof(groupName)); } var message = new LeaveGroupMessage(connectionId, groupName); // Send this message from a fixed service connection, so that message order can be reserved. return(ServiceConnectionContainer.WriteAsync(groupName, message)); }
private bool LeaveGroupMessagesEqual(LeaveGroupMessage x, LeaveGroupMessage y) { return(StringEqual(x.ConnectionId, y.ConnectionId) && StringEqual(x.GroupName, y.GroupName)); }