コード例 #1
0
        /// <summary>
        /// Removes a connection from the specified group.
        /// </summary>
        /// <param name="connectionId">The connection id to remove from the group.</param>
        /// <param name="groupName">The name of the group</param>
        /// <returns>A task that represents the connection id being removed from the group.</returns>
        public Task Remove(string connectionId, string groupName)
        {
            var command = new SignalCommand
            {
                Type  = CommandType.RemoveFromGroup,
                Value = CreateQualifiedName(groupName)
            };

            return(_connection.Send(SignalCommand.AddCommandSuffix(connectionId), command));
        }
コード例 #2
0
        /// <summary>
        /// Returns the default signals for the <see cref="PersistentConnection"/>.
        /// </summary>
        /// <param name="connectionId">The id of the incoming connection.</param>
        /// <returns>The default signals for this <see cref="PersistentConnection"/>.</returns>
        protected IEnumerable <string> GetDefaultSignals(string connectionId)
        {
            // The list of default signals this connection cares about:
            // 1. The default signal (the type name)
            // 2. The connection id (so we can message this particular connection)
            // 3. Connection id + SIGNALRCOMMAND -> for built in commands that we need to process

            return(new string[] {
                DefaultSignal,
                connectionId,
                SignalCommand.AddCommandSuffix(connectionId)
            });
        }
コード例 #3
0
        protected virtual IConnection CreateConnection(string connectionId, IEnumerable <string> groups, HttpContextBase context)
        {
            // The list of default signals this connection cares about:
            // 1. The default signal (the type name)
            // 2. The connection id (so we can message this particular connection)
            // 3. connection id + SIGNALRCOMMAND -> for built in commands that we need to process
            var signals = new string[] {
                DefaultSignal,
                connectionId,
                SignalCommand.AddCommandSuffix(connectionId)
            };

            return(new Connection(_store, _jsonSerializer, _signaler, DefaultSignal, connectionId, signals, groups));
        }
コード例 #4
0
ファイル: Connection.cs プロジェクト: cryophobia/SignalR
 public Task SendCommand(SignalCommand command)
 {
     return(SendMessage(SignalCommand.AddCommandSuffix(_connectionId), command));
 }