Rename InvokeAsync to SendAsync on the server (#1312)

This commit is contained in:
BrennanConroy 2018-01-19 11:32:50 -08:00 committed by GitHub
parent dfe0697f06
commit d38764a8f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 175 additions and 163 deletions

View File

@ -40,9 +40,9 @@ namespace Microsoft.AspNetCore.SignalR.Microbenchmarks
}
[Benchmark]
public Task InvokeAsyncAll()
public Task SendAsyncAll()
{
return _hubContext.Clients.All.InvokeAsync("Method");
return _hubContext.Clients.All.SendAsync("Method");
}
}
}

View File

@ -29,12 +29,12 @@ namespace Microsoft.AspNetCore.SignalR.Test.Server
public Task InvokeWithString(string message)
{
return Clients.Client(Context.Connection.ConnectionId).InvokeAsync("Message", message);
return Clients.Client(Context.Connection.ConnectionId).SendAsync("Message", message);
}
public Task SendCustomObject(CustomObject customObject)
{
return Clients.Client(Context.ConnectionId).InvokeAsync("CustomObject", customObject);
return Clients.Client(Context.ConnectionId).SendAsync("CustomObject", customObject);
}
public IObservable<string> Stream()

View File

@ -17,23 +17,23 @@ namespace ChatSample.Hubs
public override async Task OnConnectedAsync()
{
await Clients.Client(Context.ConnectionId).InvokeAsync("SetUsersOnline", await GetUsersOnline());
await Clients.Client(Context.ConnectionId).SendAsync("SetUsersOnline", await GetUsersOnline());
await base.OnConnectedAsync();
}
public override Task OnUsersJoined(UserDetails[] users)
{
return Clients.Client(Context.ConnectionId).InvokeAsync("UsersJoined", new[] { users });
return Clients.Client(Context.ConnectionId).SendAsync("UsersJoined", new[] { users });
}
public override Task OnUsersLeft(UserDetails[] users)
{
return Clients.Client(Context.ConnectionId).InvokeAsync("UsersLeft", new[] { users });
return Clients.Client(Context.ConnectionId).SendAsync("UsersLeft", new[] { users });
}
public async Task Send(string message)
{
await Clients.All.InvokeAsync("Send", Context.User.Identity.Name, message);
await Clients.All.SendAsync("Send", Context.User.Identity.Name, message);
}
}
}

View File

@ -137,39 +137,39 @@ namespace ChatSample
_userTracker.UsersLeft -= OnUsersLeft;
}
public override Task InvokeAllAsync(string methodName, object[] args)
public override Task SendAllAsync(string methodName, object[] args)
{
return _wrappedHubLifetimeManager.InvokeAllAsync(methodName, args);
return _wrappedHubLifetimeManager.SendAllAsync(methodName, args);
}
public override Task InvokeAllExceptAsync(string methodName, object[] args, IReadOnlyList<string> excludedIds)
public override Task SendAllExceptAsync(string methodName, object[] args, IReadOnlyList<string> excludedIds)
{
return _wrappedHubLifetimeManager.InvokeAllExceptAsync(methodName, args, excludedIds);
return _wrappedHubLifetimeManager.SendAllExceptAsync(methodName, args, excludedIds);
}
public override Task InvokeConnectionAsync(string connectionId, string methodName, object[] args)
public override Task SendConnectionAsync(string connectionId, string methodName, object[] args)
{
return _wrappedHubLifetimeManager.InvokeConnectionAsync(connectionId, methodName, args);
return _wrappedHubLifetimeManager.SendConnectionAsync(connectionId, methodName, args);
}
public override Task InvokeConnectionsAsync(IReadOnlyList<string> connectionIds, string methodName, object[] args)
public override Task SendConnectionsAsync(IReadOnlyList<string> connectionIds, string methodName, object[] args)
{
return _wrappedHubLifetimeManager.InvokeConnectionsAsync(connectionIds, methodName, args);
return _wrappedHubLifetimeManager.SendConnectionsAsync(connectionIds, methodName, args);
}
public override Task InvokeGroupAsync(string groupName, string methodName, object[] args)
public override Task SendGroupAsync(string groupName, string methodName, object[] args)
{
return _wrappedHubLifetimeManager.InvokeGroupAsync(groupName, methodName, args);
return _wrappedHubLifetimeManager.SendGroupAsync(groupName, methodName, args);
}
public override Task InvokeGroupsAsync(IReadOnlyList<string> groupNames, string methodName, object[] args)
public override Task SendGroupsAsync(IReadOnlyList<string> groupNames, string methodName, object[] args)
{
return _wrappedHubLifetimeManager.InvokeGroupsAsync(groupNames, methodName, args);
return _wrappedHubLifetimeManager.SendGroupsAsync(groupNames, methodName, args);
}
public override Task InvokeUserAsync(string userId, string methodName, object[] args)
public override Task SendUserAsync(string userId, string methodName, object[] args)
{
return _wrappedHubLifetimeManager.InvokeUserAsync(userId, methodName, args);
return _wrappedHubLifetimeManager.SendUserAsync(userId, methodName, args);
}
public override Task AddGroupAsync(string connectionId, string groupName)
@ -182,14 +182,14 @@ namespace ChatSample
return _wrappedHubLifetimeManager.RemoveGroupAsync(connectionId, groupName);
}
public override Task InvokeGroupExceptAsync(string groupName, string methodName, object[] args, IReadOnlyList<string> excludedIds)
public override Task SendGroupExceptAsync(string groupName, string methodName, object[] args, IReadOnlyList<string> excludedIds)
{
return _wrappedHubLifetimeManager.InvokeGroupExceptAsync(groupName, methodName, args, excludedIds);
return _wrappedHubLifetimeManager.SendGroupExceptAsync(groupName, methodName, args, excludedIds);
}
public override Task InvokeUsersAsync(IReadOnlyList<string> userIds, string methodName, object[] args)
public override Task SendUsersAsync(IReadOnlyList<string> userIds, string methodName, object[] args)
{
return _wrappedHubLifetimeManager.InvokeUsersAsync(userIds, methodName, args);
return _wrappedHubLifetimeManager.SendUsersAsync(userIds, methodName, args);
}
}
}

View File

@ -12,6 +12,6 @@ namespace JwtSample
public class Broadcaster : Hub
{
public Task Broadcast(string sender, string message) =>
Clients.All.InvokeAsync("Message", sender, message);
Clients.All.SendAsync("Message", sender, message);
}
}

View File

@ -12,56 +12,56 @@ namespace SocketsSample.Hubs
{
public override async Task OnConnectedAsync()
{
await Clients.All.InvokeAsync("Send", $"{Context.ConnectionId} joined");
await Clients.All.SendAsync("Send", $"{Context.ConnectionId} joined");
}
public override async Task OnDisconnectedAsync(Exception ex)
{
await Clients.Others.InvokeAsync("Send", $"{Context.ConnectionId} left");
await Clients.Others.SendAsync("Send", $"{Context.ConnectionId} left");
}
public Task Send(string message)
{
return Clients.All.InvokeAsync("Send", $"{Context.ConnectionId}: {message}");
return Clients.All.SendAsync("Send", $"{Context.ConnectionId}: {message}");
}
public Task SendToOthers(string message)
{
return Clients.Others.InvokeAsync("Send", $"{Context.ConnectionId}: {message}");
return Clients.Others.SendAsync("Send", $"{Context.ConnectionId}: {message}");
}
public Task SendToConnection(string connectionId, string message)
{
return Clients.Client(connectionId).InvokeAsync("Send", $"Private message from {Context.ConnectionId}: {message}");
return Clients.Client(connectionId).SendAsync("Send", $"Private message from {Context.ConnectionId}: {message}");
}
public Task SendToGroup(string groupName, string message)
{
return Clients.Group(groupName).InvokeAsync("Send", $"{Context.ConnectionId}@{groupName}: {message}");
return Clients.Group(groupName).SendAsync("Send", $"{Context.ConnectionId}@{groupName}: {message}");
}
public Task SendToOthersInGroup(string groupName, string message)
{
return Clients.OthersInGroup(groupName).InvokeAsync("Send", $"{Context.ConnectionId}@{groupName}: {message}");
return Clients.OthersInGroup(groupName).SendAsync("Send", $"{Context.ConnectionId}@{groupName}: {message}");
}
public async Task JoinGroup(string groupName)
{
await Groups.AddAsync(Context.ConnectionId, groupName);
await Clients.Group(groupName).InvokeAsync("Send", $"{Context.ConnectionId} joined {groupName}");
await Clients.Group(groupName).SendAsync("Send", $"{Context.ConnectionId} joined {groupName}");
}
public async Task LeaveGroup(string groupName)
{
await Clients.Group(groupName).InvokeAsync("Send", $"{Context.ConnectionId} left {groupName}");
await Clients.Group(groupName).SendAsync("Send", $"{Context.ConnectionId} left {groupName}");
await Groups.RemoveAsync(Context.ConnectionId, groupName);
}
public Task Echo(string message)
{
return Clients.Caller.InvokeAsync("Send", $"{Context.ConnectionId}: {message}");
return Clients.Caller.SendAsync("Send", $"{Context.ConnectionId}: {message}");
}
}
}

View File

@ -60,12 +60,12 @@ namespace Microsoft.AspNetCore.SignalR
return Task.CompletedTask;
}
public override Task InvokeAllAsync(string methodName, object[] args)
public override Task SendAllAsync(string methodName, object[] args)
{
return InvokeAllWhere(methodName, args, c => true);
return SendAllWhere(methodName, args, c => true);
}
private Task InvokeAllWhere(string methodName, object[] args, Func<HubConnectionContext, bool> include)
private Task SendAllWhere(string methodName, object[] args, Func<HubConnectionContext, bool> include)
{
var count = _connections.Count;
if (count == 0)
@ -90,7 +90,7 @@ namespace Microsoft.AspNetCore.SignalR
return Task.WhenAll(tasks);
}
public override Task InvokeConnectionAsync(string connectionId, string methodName, object[] args)
public override Task SendConnectionAsync(string connectionId, string methodName, object[] args)
{
if (connectionId == null)
{
@ -109,7 +109,7 @@ namespace Microsoft.AspNetCore.SignalR
return connection.WriteAsync(message);
}
public override Task InvokeGroupAsync(string groupName, string methodName, object[] args)
public override Task SendGroupAsync(string groupName, string methodName, object[] args)
{
if (groupName == null)
{
@ -127,7 +127,7 @@ namespace Microsoft.AspNetCore.SignalR
return Task.CompletedTask;
}
public override Task InvokeGroupsAsync(IReadOnlyList<string> groupNames, string methodName, object[] args)
public override Task SendGroupsAsync(IReadOnlyList<string> groupNames, string methodName, object[] args)
{
// Each task represents the list of tasks for each of the writes within a group
var tasks = new List<Task>();
@ -150,7 +150,7 @@ namespace Microsoft.AspNetCore.SignalR
return Task.WhenAll(tasks);
}
public override Task InvokeGroupExceptAsync(string groupName, string methodName, object[] args, IReadOnlyList<string> excludedIds)
public override Task SendGroupExceptAsync(string groupName, string methodName, object[] args, IReadOnlyList<string> excludedIds)
{
if (groupName == null)
{
@ -174,9 +174,9 @@ namespace Microsoft.AspNetCore.SignalR
return new InvocationMessage(target: methodName, argumentBindingException: null, arguments: args);
}
public override Task InvokeUserAsync(string userId, string methodName, object[] args)
public override Task SendUserAsync(string userId, string methodName, object[] args)
{
return InvokeAllWhere(methodName, args, connection =>
return SendAllWhere(methodName, args, connection =>
string.Equals(connection.UserIdentifier, userId, StringComparison.Ordinal));
}
@ -193,25 +193,25 @@ namespace Microsoft.AspNetCore.SignalR
return Task.CompletedTask;
}
public override Task InvokeAllExceptAsync(string methodName, object[] args, IReadOnlyList<string> excludedIds)
public override Task SendAllExceptAsync(string methodName, object[] args, IReadOnlyList<string> excludedIds)
{
return InvokeAllWhere(methodName, args, connection =>
return SendAllWhere(methodName, args, connection =>
{
return !excludedIds.Contains(connection.ConnectionId);
});
}
public override Task InvokeConnectionsAsync(IReadOnlyList<string> connectionIds, string methodName, object[] args)
public override Task SendConnectionsAsync(IReadOnlyList<string> connectionIds, string methodName, object[] args)
{
return InvokeAllWhere(methodName, args, connection =>
return SendAllWhere(methodName, args, connection =>
{
return connectionIds.Contains(connection.ConnectionId);
});
}
public override Task InvokeUsersAsync(IReadOnlyList<string> userIds, string methodName, object[] args)
public override Task SendUsersAsync(IReadOnlyList<string> userIds, string methodName, object[] args)
{
return InvokeAllWhere(methodName, args, connection =>
return SendAllWhere(methodName, args, connection =>
{
return userIds.Contains(connection.UserIdentifier);
});

View File

@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.SignalR
public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)
{
result = _clientProxy.InvokeAsync(binder.Name, args);
result = _clientProxy.SendAsync(binder.Name, args);
return true;
}
}

View File

@ -12,23 +12,23 @@ namespace Microsoft.AspNetCore.SignalR
public abstract Task OnDisconnectedAsync(HubConnectionContext connection);
public abstract Task InvokeAllAsync(string methodName, object[] args);
public abstract Task SendAllAsync(string methodName, object[] args);
public abstract Task InvokeAllExceptAsync(string methodName, object[] args, IReadOnlyList<string> excludedIds);
public abstract Task SendAllExceptAsync(string methodName, object[] args, IReadOnlyList<string> excludedIds);
public abstract Task InvokeConnectionAsync(string connectionId, string methodName, object[] args);
public abstract Task SendConnectionAsync(string connectionId, string methodName, object[] args);
public abstract Task InvokeConnectionsAsync(IReadOnlyList<string> connectionIds, string methodName, object[] args);
public abstract Task SendConnectionsAsync(IReadOnlyList<string> connectionIds, string methodName, object[] args);
public abstract Task InvokeGroupAsync(string groupName, string methodName, object[] args);
public abstract Task SendGroupAsync(string groupName, string methodName, object[] args);
public abstract Task InvokeGroupsAsync(IReadOnlyList<string> groupNames, string methodName, object[] args);
public abstract Task SendGroupsAsync(IReadOnlyList<string> groupNames, string methodName, object[] args);
public abstract Task InvokeGroupExceptAsync(string groupName, string methodName, object[] args, IReadOnlyList<string> excludedIds);
public abstract Task SendGroupExceptAsync(string groupName, string methodName, object[] args, IReadOnlyList<string> excludedIds);
public abstract Task InvokeUserAsync(string userId, string methodName, object[] args);
public abstract Task SendUserAsync(string userId, string methodName, object[] args);
public abstract Task InvokeUsersAsync(IReadOnlyList<string> userIds, string methodName, object[] args);
public abstract Task SendUsersAsync(IReadOnlyList<string> userIds, string methodName, object[] args);
public abstract Task AddGroupAsync(string connectionId, string groupName);

View File

@ -9,10 +9,11 @@ namespace Microsoft.AspNetCore.SignalR
{
/// <summary>
/// Invokes a method on the connection(s) represented by the <see cref="IClientProxy"/> instance.
/// Does not wait for a response from the receiver.
/// </summary>
/// <param name="method">name of the method to invoke</param>
/// <param name="args">argumetns to pass to the client</param>
/// <returns>A task that represents when the data has been sent to the client.</returns>
Task InvokeAsync(string method, object[] args);
Task SendAsync(string method, object[] args);
}
}

View File

@ -9,42 +9,46 @@ namespace Microsoft.AspNetCore.SignalR
{
/// <summary>
/// Invokes a method on the connection(s) represented by the <see cref="IClientProxy"/> instance.
/// Does not wait for a response from the receiver.
/// </summary>
/// <param name="clientProxy">The <see cref="IClientProxy"/></param>
/// <param name="method">name of the method to invoke</param>
/// <returns>A task that represents when the data has been sent to the client.</returns>
public static Task InvokeAsync(this IClientProxy clientProxy, string method)
public static Task SendAsync(this IClientProxy clientProxy, string method)
{
return clientProxy.InvokeAsync(method, Array.Empty<object>());
return clientProxy.SendAsync(method, Array.Empty<object>());
}
/// <summary>
/// Invokes a method on the connection(s) represented by the <see cref="IClientProxy"/> instance.
/// Does not wait for a response from the receiver.
/// </summary>
/// <param name="clientProxy">The <see cref="IClientProxy"/></param>
/// <param name="method">name of the method to invoke</param>
/// <param name="arg1">The first argument</param>
/// <returns>A task that represents when the data has been sent to the client.</returns>
public static Task InvokeAsync(this IClientProxy clientProxy, string method, object arg1)
public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1)
{
return clientProxy.InvokeAsync(method, new object[] { arg1 });
return clientProxy.SendAsync(method, new object[] { arg1 });
}
/// <summary>
/// Invokes a method on the connection(s) represented by the <see cref="IClientProxy"/> instance.
/// Does not wait for a response from the receiver.
/// </summary>
/// <param name="clientProxy">The <see cref="IClientProxy"/></param>
/// <param name="method">name of the method to invoke</param>
/// <param name="arg1">The first argument</param>
/// <param name="arg2">The second argument</param>
/// <returns>A task that represents when the data has been sent to the client.</returns>
public static Task InvokeAsync(this IClientProxy clientProxy, string method, object arg1, object arg2)
public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2)
{
return clientProxy.InvokeAsync(method, new object[] { arg1, arg2 });
return clientProxy.SendAsync(method, new object[] { arg1, arg2 });
}
/// <summary>
/// Invokes a method on the connection(s) represented by the <see cref="IClientProxy"/> instance.
/// Does not wait for a response from the receiver.
/// </summary>
/// <param name="clientProxy">The <see cref="IClientProxy"/></param>
/// <param name="method">name of the method to invoke</param>
@ -52,13 +56,14 @@ namespace Microsoft.AspNetCore.SignalR
/// <param name="arg2">The second argument</param>
/// <param name="arg3">The third argument</param>
/// <returns>A task that represents when the data has been sent to the client.</returns>
public static Task InvokeAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3)
public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3)
{
return clientProxy.InvokeAsync(method, new object[] { arg1, arg2, arg3 });
return clientProxy.SendAsync(method, new object[] { arg1, arg2, arg3 });
}
/// <summary>
/// Invokes a method on the connection(s) represented by the <see cref="IClientProxy"/> instance.
/// Does not wait for a response from the receiver.
/// </summary>
/// <param name="clientProxy">The <see cref="IClientProxy"/></param>
/// <param name="method">name of the method to invoke</param>
@ -67,13 +72,14 @@ namespace Microsoft.AspNetCore.SignalR
/// <param name="arg3">The third argument</param>
/// <param name="arg4">The fourth argument</param>
/// <returns>A task that represents when the data has been sent to the client.</returns>
public static Task InvokeAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4)
public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4)
{
return clientProxy.InvokeAsync(method, new object[] { arg1, arg2, arg3, arg4 });
return clientProxy.SendAsync(method, new object[] { arg1, arg2, arg3, arg4 });
}
/// <summary>
/// Invokes a method on the connection(s) represented by the <see cref="IClientProxy"/> instance.
/// Does not wait for a response from the receiver.
/// </summary>
/// <param name="clientProxy">The <see cref="IClientProxy"/></param>
/// <param name="method">name of the method to invoke</param>
@ -83,13 +89,14 @@ namespace Microsoft.AspNetCore.SignalR
/// <param name="arg4">The fourth argument</param>
/// <param name="arg5">The fifth argument</param>
/// <returns>A task that represents when the data has been sent to the client.</returns>
public static Task InvokeAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4, object arg5)
public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4, object arg5)
{
return clientProxy.InvokeAsync(method, new object[] { arg1, arg2, arg3, arg4, arg5 });
return clientProxy.SendAsync(method, new object[] { arg1, arg2, arg3, arg4, arg5 });
}
/// <summary>
/// Invokes a method on the connection(s) represented by the <see cref="IClientProxy"/> instance.
/// Does not wait for a response from the receiver.
/// </summary>
/// <param name="clientProxy">The <see cref="IClientProxy"/></param>
/// <param name="method">name of the method to invoke</param>
@ -100,13 +107,14 @@ namespace Microsoft.AspNetCore.SignalR
/// <param name="arg5">The fifth argument</param>
/// <param name="arg6">The sixth argument</param>
/// <returns>A task that represents when the data has been sent to the client.</returns>
public static Task InvokeAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6)
public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6)
{
return clientProxy.InvokeAsync(method, new object[] { arg1, arg2, arg3, arg4, arg5, arg6 });
return clientProxy.SendAsync(method, new object[] { arg1, arg2, arg3, arg4, arg5, arg6 });
}
/// <summary>
/// Invokes a method on the connection(s) represented by the <see cref="IClientProxy"/> instance.
/// Does not wait for a response from the receiver.
/// </summary>
/// <param name="clientProxy">The <see cref="IClientProxy"/></param>
/// <param name="method">name of the method to invoke</param>
@ -118,13 +126,14 @@ namespace Microsoft.AspNetCore.SignalR
/// <param name="arg6">The sixth argument</param>
/// <param name="arg7">The seventh argument</param>
/// <returns>A task that represents when the data has been sent to the client.</returns>
public static Task InvokeAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7)
public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7)
{
return clientProxy.InvokeAsync(method, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7 });
return clientProxy.SendAsync(method, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7 });
}
/// <summary>
/// Invokes a method on the connection(s) represented by the <see cref="IClientProxy"/> instance.
/// Does not wait for a response from the receiver.
/// </summary>
/// <param name="clientProxy">The <see cref="IClientProxy"/></param>
/// <param name="method">name of the method to invoke</param>
@ -137,13 +146,14 @@ namespace Microsoft.AspNetCore.SignalR
/// <param name="arg7">The seventh argument</param>
/// <param name="arg8">The eigth argument</param>
/// <returns>A task that represents when the data has been sent to the client.</returns>
public static Task InvokeAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8)
public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8)
{
return clientProxy.InvokeAsync(method, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 });
return clientProxy.SendAsync(method, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 });
}
/// <summary>
/// Invokes a method on the connection(s) represented by the <see cref="IClientProxy"/> instance.
/// Does not wait for a response from the receiver.
/// </summary>
/// <param name="clientProxy">The <see cref="IClientProxy"/></param>
/// <param name="method">name of the method to invoke</param>
@ -157,13 +167,14 @@ namespace Microsoft.AspNetCore.SignalR
/// <param name="arg8">The eigth argument</param>
/// <param name="arg9">The ninth argument</param>
/// <returns>A task that represents when the data has been sent to the client.</returns>
public static Task InvokeAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8, object arg9)
public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8, object arg9)
{
return clientProxy.InvokeAsync(method, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 });
return clientProxy.SendAsync(method, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 });
}
/// <summary>
/// Invokes a method on the connection(s) represented by the <see cref="IClientProxy"/> instance.
/// Does not wait for a response from the receiver.
/// </summary>
/// <param name="clientProxy">The <see cref="IClientProxy"/></param>
/// <param name="method">name of the method to invoke</param>
@ -178,9 +189,9 @@ namespace Microsoft.AspNetCore.SignalR
/// <param name="arg9">The ninth argument</param>
/// <param name="arg10">The tenth argument</param>
/// <returns>A task that represents when the data has been sent to the client.</returns>
public static Task InvokeAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8, object arg9, object arg10)
public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8, object arg9, object arg10)
{
return clientProxy.InvokeAsync(method, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 });
return clientProxy.SendAsync(method, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 });
}
}
}

View File

@ -17,9 +17,9 @@ namespace Microsoft.AspNetCore.SignalR
_userId = userId;
}
public Task InvokeAsync(string method, params object[] args)
public Task SendAsync(string method, params object[] args)
{
return _lifetimeManager.InvokeUserAsync(_userId, method, args);
return _lifetimeManager.SendUserAsync(_userId, method, args);
}
}
@ -34,9 +34,9 @@ namespace Microsoft.AspNetCore.SignalR
_userIds = userIds;
}
public Task InvokeAsync(string method, params object[] args)
public Task SendAsync(string method, params object[] args)
{
return _lifetimeManager.InvokeUsersAsync(_userIds, method, args);
return _lifetimeManager.SendUsersAsync(_userIds, method, args);
}
}
@ -51,9 +51,9 @@ namespace Microsoft.AspNetCore.SignalR
_groupName = groupName;
}
public Task InvokeAsync(string method, params object[] args)
public Task SendAsync(string method, params object[] args)
{
return _lifetimeManager.InvokeGroupAsync(_groupName, method, args);
return _lifetimeManager.SendGroupAsync(_groupName, method, args);
}
}
@ -68,9 +68,9 @@ namespace Microsoft.AspNetCore.SignalR
_groupNames = groupNames;
}
public Task InvokeAsync(string method, params object[] args)
public Task SendAsync(string method, params object[] args)
{
return _lifetimeManager.InvokeGroupsAsync(_groupNames, method, args);
return _lifetimeManager.SendGroupsAsync(_groupNames, method, args);
}
}
@ -87,9 +87,9 @@ namespace Microsoft.AspNetCore.SignalR
_excludedIds = excludedIds;
}
public Task InvokeAsync(string method, params object[] args)
public Task SendAsync(string method, params object[] args)
{
return _lifetimeManager.InvokeGroupExceptAsync(_groupName, method, args, _excludedIds);
return _lifetimeManager.SendGroupExceptAsync(_groupName, method, args, _excludedIds);
}
}
@ -102,9 +102,9 @@ namespace Microsoft.AspNetCore.SignalR
_lifetimeManager = lifetimeManager;
}
public Task InvokeAsync(string method, params object[] args)
public Task SendAsync(string method, params object[] args)
{
return _lifetimeManager.InvokeAllAsync(method, args);
return _lifetimeManager.SendAllAsync(method, args);
}
}
@ -119,9 +119,9 @@ namespace Microsoft.AspNetCore.SignalR
_excludedIds = excludedIds;
}
public Task InvokeAsync(string method, params object[] args)
public Task SendAsync(string method, params object[] args)
{
return _lifetimeManager.InvokeAllExceptAsync(method, args, _excludedIds);
return _lifetimeManager.SendAllExceptAsync(method, args, _excludedIds);
}
}
@ -136,9 +136,9 @@ namespace Microsoft.AspNetCore.SignalR
_connectionId = connectionId;
}
public Task InvokeAsync(string method, params object[] args)
public Task SendAsync(string method, params object[] args)
{
return _lifetimeManager.InvokeConnectionAsync(_connectionId, method, args);
return _lifetimeManager.SendConnectionAsync(_connectionId, method, args);
}
}
@ -153,9 +153,9 @@ namespace Microsoft.AspNetCore.SignalR
_connectionIds = connectionIds;
}
public Task InvokeAsync(string method, params object[] args)
public Task SendAsync(string method, params object[] args)
{
return _lifetimeManager.InvokeConnectionsAsync(_connectionIds, method, args);
return _lifetimeManager.SendConnectionsAsync(_connectionIds, method, args);
}
}

View File

@ -115,7 +115,7 @@ namespace Microsoft.AspNetCore.SignalR
var methodBuilder = type.DefineMethod(interfaceMethodInfo.Name, methodAttributes);
var invokeMethod = typeof(IClientProxy).GetMethod(
"InvokeAsync", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null,
"SendAsync", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null,
new Type[] { typeof(string), typeof(object[]) }, null);
methodBuilder.SetReturnType(interfaceMethodInfo.ReturnType);
@ -132,14 +132,14 @@ namespace Microsoft.AspNetCore.SignalR
var generator = methodBuilder.GetILGenerator();
// Declare local variable to store the arguments to IClientProxy.InvokeAsync
// Declare local variable to store the arguments to IClientProxy.SendAsync
generator.DeclareLocal(typeof(object[]));
// Get IClientProxy
generator.Emit(OpCodes.Ldarg_0);
generator.Emit(OpCodes.Ldfld, proxyField);
// The first argument to IClientProxy.InvokeAsync is this method's name
// The first argument to IClientProxy.SendAsync is this method's name
generator.Emit(OpCodes.Ldstr, interfaceMethodInfo.Name);
// Create an new object array to hold all the parameters to this method
@ -157,7 +157,7 @@ namespace Microsoft.AspNetCore.SignalR
generator.Emit(OpCodes.Stelem_Ref);
}
// Call InvokeAsync
// Call SendAsync
generator.Emit(OpCodes.Ldloc_0);
generator.Emit(OpCodes.Callvirt, invokeMethod);

View File

@ -146,20 +146,20 @@ namespace Microsoft.AspNetCore.SignalR.Redis
return Task.WhenAll(tasks);
}
public override Task InvokeAllAsync(string methodName, object[] args)
public override Task SendAllAsync(string methodName, object[] args)
{
var message = new RedisInvocationMessage(target: methodName, arguments: args);
return PublishAsync(_channelNamePrefix, message);
}
public override Task InvokeAllExceptAsync(string methodName, object[] args, IReadOnlyList<string> excludedIds)
public override Task SendAllExceptAsync(string methodName, object[] args, IReadOnlyList<string> excludedIds)
{
var message = new RedisInvocationMessage(target: methodName, excludedIds: excludedIds, arguments: args);
return PublishAsync(_channelNamePrefix + ".AllExcept", message);
}
public override Task InvokeConnectionAsync(string connectionId, string methodName, object[] args)
public override Task SendConnectionAsync(string connectionId, string methodName, object[] args)
{
if (connectionId == null)
{
@ -179,7 +179,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis
return PublishAsync(_channelNamePrefix + "." + connectionId, message);
}
public override Task InvokeGroupAsync(string groupName, string methodName, object[] args)
public override Task SendGroupAsync(string groupName, string methodName, object[] args)
{
if (groupName == null)
{
@ -191,7 +191,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis
return PublishAsync(_channelNamePrefix + ".group." + groupName, message);
}
public override Task InvokeGroupExceptAsync(string groupName, string methodName, object[] args, IReadOnlyList<string> excludedIds)
public override Task SendGroupExceptAsync(string groupName, string methodName, object[] args, IReadOnlyList<string> excludedIds)
{
if (groupName == null)
{
@ -203,7 +203,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis
return PublishAsync(_channelNamePrefix + ".group." + groupName, message);
}
public override Task InvokeUserAsync(string userId, string methodName, object[] args)
public override Task SendUserAsync(string userId, string methodName, object[] args)
{
var message = new RedisInvocationMessage(methodName, args);
@ -574,7 +574,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis
});
}
public override Task InvokeConnectionsAsync(IReadOnlyList<string> connectionIds, string methodName, object[] args)
public override Task SendConnectionsAsync(IReadOnlyList<string> connectionIds, string methodName, object[] args)
{
if (connectionIds == null)
{
@ -601,7 +601,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis
return Task.WhenAll(publishTasks);
}
public override Task InvokeGroupsAsync(IReadOnlyList<string> groupNames, string methodName, object[] args)
public override Task SendGroupsAsync(IReadOnlyList<string> groupNames, string methodName, object[] args)
{
if (groupNames == null)
{
@ -621,7 +621,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis
return Task.WhenAll(publishTasks);
}
public override Task InvokeUsersAsync(IReadOnlyList<string> userIds, string methodName, object[] args)
public override Task SendUsersAsync(IReadOnlyList<string> userIds, string methodName, object[] args)
{
if (userIds.Count > 0)
{

View File

@ -26,12 +26,12 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
public async Task CallEcho(string message)
{
await Clients.Client(Context.ConnectionId).InvokeAsync("Echo", message);
await Clients.Client(Context.ConnectionId).SendAsync("Echo", message);
}
public async Task CallHandlerThatDoesntExist()
{
await Clients.Client(Context.ConnectionId).InvokeAsync("NoClientHandler");
await Clients.Client(Context.ConnectionId).SendAsync("NoClientHandler");
}
public IEnumerable<string> GetHeaderValues(string[] headerNames)

View File

@ -15,7 +15,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests
public Task EchoGroup(string group, string message)
{
return Clients.Group(group).InvokeAsync("Echo", message);
return Clients.Group(group).SendAsync("Echo", message);
}
public Task AddSelfToGroup(string group)

View File

@ -38,7 +38,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests
await manager.OnConnectedAsync(connection1).OrTimeout();
await manager.OnConnectedAsync(connection2).OrTimeout();
await manager.InvokeAllAsync("Hello", new object[] { "World" }).OrTimeout();
await manager.SendAllAsync("Hello", new object[] { "World" }).OrTimeout();
await AssertMessageAsync(client1);
await AssertMessageAsync(client2);
@ -64,7 +64,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests
await manager.OnDisconnectedAsync(connection2).OrTimeout();
await manager.InvokeAllAsync("Hello", new object[] { "World" }).OrTimeout();
await manager.SendAllAsync("Hello", new object[] { "World" }).OrTimeout();
await AssertMessageAsync(client1);
@ -93,7 +93,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests
await manager.AddGroupAsync(connection1.ConnectionId, "gunit").OrTimeout();
await manager.InvokeGroupAsync("gunit", "Hello", new object[] { "World" }).OrTimeout();
await manager.SendGroupAsync("gunit", "Hello", new object[] { "World" }).OrTimeout();
await AssertMessageAsync(client1);
Assert.Null(client2.TryRead());
@ -124,7 +124,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests
await manager.AddGroupAsync(connection2.ConnectionId, "gunit").OrTimeout();
var excludedIds = new List<string>{ client2.Connection.ConnectionId };
await manager.InvokeGroupExceptAsync("gunit", "Hello", new object[] { "World" }, excludedIds).OrTimeout();
await manager.SendGroupExceptAsync("gunit", "Hello", new object[] { "World" }, excludedIds).OrTimeout();
await AssertMessageAsync(client1);
Assert.Null(client2.TryRead());
@ -148,7 +148,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests
await manager.OnConnectedAsync(connection).OrTimeout();
await manager.InvokeConnectionAsync(connection.ConnectionId, "Hello", new object[] { "World" }).OrTimeout();
await manager.SendConnectionAsync(connection.ConnectionId, "Hello", new object[] { "World" }).OrTimeout();
await connection.DisposeAsync().OrTimeout();
@ -164,7 +164,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests
{
Factory = t => new TestConnectionMultiplexer()
}));
await manager.InvokeConnectionAsync("NotARealConnectionId", "Hello", new object[] { "World" }).OrTimeout();
await manager.SendConnectionAsync("NotARealConnectionId", "Hello", new object[] { "World" }).OrTimeout();
}
[Fact]
@ -190,7 +190,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests
await manager1.OnConnectedAsync(connection1).OrTimeout();
await manager2.OnConnectedAsync(connection2).OrTimeout();
await manager1.InvokeAllAsync("Hello", new object[] { "World" }).OrTimeout();
await manager1.SendAllAsync("Hello", new object[] { "World" }).OrTimeout();
await AssertMessageAsync(client1);
await AssertMessageAsync(client2);
@ -222,7 +222,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests
await manager2.OnDisconnectedAsync(connection2).OrTimeout();
await manager2.InvokeAllAsync("Hello", new object[] { "World" }).OrTimeout();
await manager2.SendAllAsync("Hello", new object[] { "World" }).OrTimeout();
await AssertMessageAsync(client1);
@ -252,7 +252,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests
await manager1.OnConnectedAsync(connection).OrTimeout();
await manager2.InvokeConnectionAsync(connection.ConnectionId, "Hello", new object[] { "World" }).OrTimeout();
await manager2.SendConnectionAsync(connection.ConnectionId, "Hello", new object[] { "World" }).OrTimeout();
await AssertMessageAsync(client);
}
@ -280,7 +280,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests
await manager1.AddGroupAsync(connection.ConnectionId, "name").OrTimeout();
await manager2.InvokeGroupAsync("name", "Hello", new object[] { "World" }).OrTimeout();
await manager2.SendGroupAsync("name", "Hello", new object[] { "World" }).OrTimeout();
await AssertMessageAsync(client);
}
@ -305,7 +305,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests
await manager.OnDisconnectedAsync(connection).OrTimeout();
await manager.InvokeGroupAsync("name", "Hello", new object[] { "World" }).OrTimeout();
await manager.SendGroupAsync("name", "Hello", new object[] { "World" }).OrTimeout();
await connection.DisposeAsync().OrTimeout();
Assert.Null(client.TryRead());
@ -375,7 +375,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests
await manager2.AddGroupAsync(connection.ConnectionId, "name").OrTimeout();
await manager2.InvokeGroupAsync("name", "Hello", new object[] { "World" }).OrTimeout();
await manager2.SendGroupAsync("name", "Hello", new object[] { "World" }).OrTimeout();
await connection.DisposeAsync().OrTimeout();
@ -400,7 +400,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests
await manager.AddGroupAsync(connection.ConnectionId, "name").OrTimeout();
await manager.AddGroupAsync(connection.ConnectionId, "name").OrTimeout();
await manager.InvokeGroupAsync("name", "Hello", new object[] { "World" }).OrTimeout();
await manager.SendGroupAsync("name", "Hello", new object[] { "World" }).OrTimeout();
await connection.DisposeAsync().OrTimeout();
@ -431,7 +431,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests
await manager1.AddGroupAsync(connection.ConnectionId, "name").OrTimeout();
await manager2.AddGroupAsync(connection.ConnectionId, "name").OrTimeout();
await manager2.InvokeGroupAsync("name", "Hello", new object[] { "World" }).OrTimeout();
await manager2.SendGroupAsync("name", "Hello", new object[] { "World" }).OrTimeout();
await connection.DisposeAsync().OrTimeout();
@ -461,13 +461,13 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests
await manager1.AddGroupAsync(connection.ConnectionId, "name").OrTimeout();
await manager2.InvokeGroupAsync("name", "Hello", new object[] { "World" }).OrTimeout();
await manager2.SendGroupAsync("name", "Hello", new object[] { "World" }).OrTimeout();
await AssertMessageAsync(client);
await manager2.RemoveGroupAsync(connection.ConnectionId, "name").OrTimeout();
await manager2.InvokeGroupAsync("name", "Hello", new object[] { "World" }).OrTimeout();
await manager2.SendGroupAsync("name", "Hello", new object[] { "World" }).OrTimeout();
await connection.DisposeAsync().OrTimeout();
Assert.Null(client.TryRead());
@ -494,7 +494,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests
await manager1.OnConnectedAsync(connection).OrTimeout();
await manager2.OnConnectedAsync(connection).OrTimeout();
await manager1.InvokeConnectionAsync(connection.ConnectionId, "Hello", new object[] { "World" }).OrTimeout();
await manager1.SendConnectionAsync(connection.ConnectionId, "Hello", new object[] { "World" }).OrTimeout();
await connection.DisposeAsync().OrTimeout();
@ -527,7 +527,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests
// This doesn't throw because there is no connection.ConnectionId on this server so it has to publish to redis.
// And once that happens there is no way to know if the invocation was successful or not.
await manager1.InvokeConnectionAsync(connection.ConnectionId, "Hello", new object[] { "World" }).OrTimeout();
await manager1.SendConnectionAsync(connection.ConnectionId, "Hello", new object[] { "World" }).OrTimeout();
}
}
@ -549,7 +549,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests
await manager.OnConnectedAsync(connection).OrTimeout();
var exception = await Assert.ThrowsAsync<Exception>(() => manager.InvokeConnectionAsync(connection.ConnectionId, "Hello", new object[] { "World" }).OrTimeout());
var exception = await Assert.ThrowsAsync<Exception>(() => manager.SendConnectionAsync(connection.ConnectionId, "Hello", new object[] { "World" }).OrTimeout());
Assert.Equal("Message", exception.Message);
}
}
@ -577,13 +577,13 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests
await manager.OnConnectedAsync(connection2).OrTimeout();
await manager.AddGroupAsync(connection2.ConnectionId, "group");
await manager.InvokeGroupAsync("group", "Hello", new object[] { "World" }).OrTimeout();
await manager.SendGroupAsync("group", "Hello", new object[] { "World" }).OrTimeout();
// connection1 will throw when receiving a group message, we are making sure other connections
// are not affected by another connection throwing
await AssertMessageAsync(client2);
// Repeat to check that group can still be sent to
await manager.InvokeGroupAsync("group", "Hello", new object[] { "World" }).OrTimeout();
await manager.SendGroupAsync("group", "Hello", new object[] { "World" }).OrTimeout();
await AssertMessageAsync(client2);
}
}

View File

@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
await manager.OnConnectedAsync(connection1).OrTimeout();
await manager.OnConnectedAsync(connection2).OrTimeout();
await manager.InvokeAllAsync("Hello", new object[] { "World" }).OrTimeout();
await manager.SendAllAsync("Hello", new object[] { "World" }).OrTimeout();
await connection1.DisposeAsync().OrTimeout();
await connection2.DisposeAsync().OrTimeout();
@ -55,7 +55,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
await manager.OnDisconnectedAsync(connection2).OrTimeout();
await manager.InvokeAllAsync("Hello", new object[] { "World" }).OrTimeout();
await manager.SendAllAsync("Hello", new object[] { "World" }).OrTimeout();
await connection1.DisposeAsync().OrTimeout();
await connection2.DisposeAsync().OrTimeout();
@ -84,7 +84,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
await manager.AddGroupAsync(connection1.ConnectionId, "gunit").OrTimeout();
await manager.InvokeGroupAsync("gunit", "Hello", new object[] { "World" }).OrTimeout();
await manager.SendGroupAsync("gunit", "Hello", new object[] { "World" }).OrTimeout();
await connection1.DisposeAsync().OrTimeout();
await connection2.DisposeAsync().OrTimeout();
@ -108,7 +108,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
await manager.OnConnectedAsync(connection).OrTimeout();
await manager.InvokeConnectionAsync(connection.ConnectionId, "Hello", new object[] { "World" }).OrTimeout();
await manager.SendConnectionAsync(connection.ConnectionId, "Hello", new object[] { "World" }).OrTimeout();
await connection.DisposeAsync().OrTimeout();
@ -133,7 +133,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
await manager.OnConnectedAsync(connection).OrTimeout();
var exception = await Assert.ThrowsAsync<Exception>(() => manager.InvokeConnectionAsync(connection.ConnectionId, "Hello", new object[] { "World" }).OrTimeout());
var exception = await Assert.ThrowsAsync<Exception>(() => manager.SendConnectionAsync(connection.ConnectionId, "Hello", new object[] { "World" }).OrTimeout());
Assert.Equal("Message", exception.Message);
}
}
@ -142,7 +142,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
public async Task InvokeConnectionAsyncOnNonExistentConnectionNoops()
{
var manager = new DefaultHubLifetimeManager<MyHub>();
await manager.InvokeConnectionAsync("NotARealConnectionId", "Hello", new object[] { "World" }).OrTimeout();
await manager.SendConnectionAsync("NotARealConnectionId", "Hello", new object[] { "World" }).OrTimeout();
}
[Fact]

View File

@ -19,22 +19,22 @@ namespace Microsoft.AspNetCore.SignalR.Tests.HubEndpointTestUtils
public Task ClientSendMethod(string userId, string message)
{
return Clients.User(userId).InvokeAsync("Send", message);
return Clients.User(userId).SendAsync("Send", message);
}
public Task SendToMultipleUsers(IReadOnlyList<string> userIds, string message)
{
return Clients.Users(userIds).InvokeAsync("Send", message);
return Clients.Users(userIds).SendAsync("Send", message);
}
public Task ConnectionSendMethod(string connectionId, string message)
{
return Clients.Client(connectionId).InvokeAsync("Send", message);
return Clients.Client(connectionId).SendAsync("Send", message);
}
public Task SendToMultipleClients(string message, IReadOnlyList<string> connectionIds)
{
return Clients.Clients(connectionIds).InvokeAsync("Send", message);
return Clients.Clients(connectionIds).SendAsync("Send", message);
}
public Task GroupAddMethod(string groupName)
@ -44,37 +44,37 @@ namespace Microsoft.AspNetCore.SignalR.Tests.HubEndpointTestUtils
public Task GroupSendMethod(string groupName, string message)
{
return Clients.Group(groupName).InvokeAsync("Send", message);
return Clients.Group(groupName).SendAsync("Send", message);
}
public Task GroupExceptSendMethod(string groupName, string message, IReadOnlyList<string> excludedIds)
{
return Clients.GroupExcept(groupName, excludedIds).InvokeAsync("Send", message);
return Clients.GroupExcept(groupName, excludedIds).SendAsync("Send", message);
}
public Task SendToMultipleGroups(string message, IReadOnlyList<string> groupNames)
{
return Clients.Groups(groupNames).InvokeAsync("Send", message);
return Clients.Groups(groupNames).SendAsync("Send", message);
}
public Task SendToOthersInGroup(string groupName, string message)
{
return Clients.OthersInGroup(groupName).InvokeAsync("Send", message);
return Clients.OthersInGroup(groupName).SendAsync("Send", message);
}
public Task BroadcastMethod(string message)
{
return Clients.All.InvokeAsync("Broadcast", message);
return Clients.All.SendAsync("Broadcast", message);
}
public Task BroadcastItem()
{
return Clients.All.InvokeAsync("Broadcast", new Result { Message = "test", paramName = "param" });
return Clients.All.SendAsync("Broadcast", new Result { Message = "test", paramName = "param" });
}
public Task SendArray()
{
return Clients.All.InvokeAsync("Array", new int[] { 1, 2, 3 });
return Clients.All.SendAsync("Array", new int[] { 1, 2, 3 });
}
public Task<int> TaskValueMethod()
@ -109,7 +109,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests.HubEndpointTestUtils
public Task SendAnonymousObject()
{
return Clients.Client(Context.ConnectionId).InvokeAsync("Send", new { });
return Clients.Client(Context.ConnectionId).SendAsync("Send", new { });
}
public override Task OnDisconnectedAsync(Exception e)
@ -138,7 +138,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests.HubEndpointTestUtils
public Task SendToAllExcept(string message, IReadOnlyList<string> excludedIds)
{
return Clients.AllExcept(excludedIds).InvokeAsync("Send", message);
return Clients.AllExcept(excludedIds).SendAsync("Send", message);
}
public bool HasHttpContext()
@ -148,12 +148,12 @@ namespace Microsoft.AspNetCore.SignalR.Tests.HubEndpointTestUtils
public Task SendToOthers(string message)
{
return Clients.Others.InvokeAsync("Send", message);
return Clients.Others.SendAsync("Send", message);
}
public Task SendToCaller(string message)
{
return Clients.Caller.InvokeAsync("Send", message);
return Clients.Caller.SendAsync("Send", message);
}
}
@ -563,7 +563,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests.HubEndpointTestUtils
{
public override async Task OnConnectedAsync()
{
await Clients.All.InvokeAsync("Send", $"{Context.ConnectionId} joined");
await Clients.All.SendAsync("Send", $"{Context.ConnectionId} joined");
await base.OnConnectedAsync();
}
}

View File

@ -294,7 +294,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
{
var serviceProvider = HubEndPointTestUtils.CreateServiceProvider();
var context = serviceProvider.GetRequiredService<IHubContext<SimpleHub>>();
await context.Clients.All.InvokeAsync("Send", "test");
await context.Clients.All.SendAsync("Send", "test");
}
[Fact]