コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
        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);
                }
            }
        }
コード例 #3
0
        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);
                }
            }
        }
コード例 #4
0
        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);
                }
            }
        }