public async Task InvokeClientMethodToGroupAsync(string groupID, string methodName, params object[] arguments) { var sockets = WebSocketConnectionManager.GetAllFromGroup(groupID); if (sockets != null) { foreach (var id in sockets) { await InvokeClientMethodAsync(id, methodName, arguments); } } }
public async Task SendMessageToGroupAsync(string groupID, Message message) { var sockets = WebSocketConnectionManager.GetAllFromGroup(groupID); if (sockets != null) { foreach (var socket in sockets) { await SendMessageAsync(socket, message); } } }
public async Task SendMessageToGroupAsync(string groupID, Message message) { var sockets = WebSocketConnectionManager.GetAllFromGroup(groupID); if (sockets != null) { foreach (var socket in sockets) { if (message.Channel == null || message.Channel == string.Empty) { message.Channel = groupID; } await SendMessageAsync(socket, message); } } }
public async Task SendGroupNotifyAsync(string groupID, string methodName, object result) { // create the method invocation descriptor. InvocationDescriptor invocationDescriptor = new InvocationDescriptor { MethodName = methodName, Params = result }; var message = new Message() { MessageType = MessageType.MethodInvocation, Data = JsonConvert.SerializeObject(invocationDescriptor) }; var sockets = WebSocketConnectionManager.GetAllFromGroup(groupID); if (sockets != null) { foreach (var id in sockets) { await SendMessageAsync(id, message); } } }