Exemplo n.º 1
0
        /// <summary>
        /// Sends Pings with the specified <see cref="string"/> to all clients.
        /// </summary>
        /// <returns>
        /// A Dictionary&lt;string, bool&gt; that contains the collection of session IDs and values
        /// indicating whether the service host received the Pongs from each clients in a time.
        /// </returns>
        /// <param name="message">
        /// A <see cref="string"/> that contains a message to send.
        /// </param>
        public Dictionary <string, bool> Broadping(string message)
        {
            if (message.IsNullOrEmpty())
            {
                return(_sessions.Broadping(String.Empty));
            }

            var len = Encoding.UTF8.GetBytes(message).Length;

            if (len > 125)
            {
                var msg = "The payload length of a Ping frame must be 125 bytes or less.";
                Log.Error(msg);
                Error(msg);

                return(null);
            }

            return(_sessions.Broadping(message));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Sends Pings to the clients of every <see cref="WebSocketService"/> instances
 /// in the <see cref="WebSocketService.Sessions"/>.
 /// </summary>
 /// <returns>
 /// A Dictionary&lt;string, bool&gt; that contains the collection of IDs and values indicating
 /// whether the each <see cref="WebSocketService"/> instances received a Pong in a time.
 /// </returns>
 public virtual Dictionary <string, bool> Broadping()
 {
     return(IsBound
      ? _sessions.Broadping(String.Empty)
      : null);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Pings with the specified <see cref="string"/> to all clients.
 /// </summary>
 /// <returns>
 /// A Dictionary&lt;string, bool&gt; that contains the collection of session IDs and values
 /// indicating whether the server received the Pongs from each clients in a time.
 /// </returns>
 /// <param name="message">
 /// A <see cref="string"/> that contains a message.
 /// </param>
 public Dictionary <string, bool> Broadping(string message)
 {
     return(_sessions.Broadping(message));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Pings with the specified <see cref="string"/> to the clients of every <see cref="WebSocketService"/> instances
 /// in the <see cref="WebSocketService.Sessions"/>.
 /// </summary>
 /// <returns>
 /// A Dictionary&lt;string, bool&gt; that contains the collection of IDs and values
 /// indicating whether each <see cref="WebSocketService"/> instances received a Pong in a time.
 /// </returns>
 /// <param name="message">
 /// A <see cref="string"/> that contains a message.
 /// </param>
 public Dictionary <string, bool> Broadping(string message)
 {
     return(IsBound
      ? _sessions.Broadping(message)
      : null);
 }