示例#1
0
        /// <summary>
        /// Pings with the specified <see cref="string"/> to the client of the <see cref="WebSocketService"/> instance
        /// associated with the specified <paramref name="id"/>.
        /// </summary>
        /// <returns>
        /// <c>true</c> if the <see cref="WebSocketService"/> instance receives a Pong in a time; otherwise, <c>false</c>.
        /// </returns>
        /// <param name="id">
        /// A <see cref="string"/> that contains an ID that represents the destination for the Ping.
        /// </param>
        /// <param name="message">
        /// A <see cref="string"/> that contains a message.
        /// </param>
        public bool PingTo(string id, string message)
        {
            if (!IsBound)
            {
                return(false);
            }

            WebSocketService service;

            return(_sessions.TryGetWebSocketService(id, out service)
             ? service.Ping(message)
             : false);
        }