[Modify] Add a property

Add IsPing property to determine that the message type is ping.
This commit is contained in:
sta 2015-11-14 15:04:44 +09:00
parent 6da68d455a
commit 5eff459c44

View File

@ -36,7 +36,7 @@ namespace WebSocketSharp
/// <remarks> /// <remarks>
/// <para> /// <para>
/// A <see cref="WebSocket.OnMessage"/> event occurs when the <see cref="WebSocket"/> receives /// A <see cref="WebSocket.OnMessage"/> event occurs when the <see cref="WebSocket"/> receives
/// a text or binary message, or a Ping if the <see cref="WebSocket.EmitOnPing"/> property is /// a text or binary message, or a ping if the <see cref="WebSocket.EmitOnPing"/> property is
/// set to <c>true</c>. /// set to <c>true</c>.
/// </para> /// </para>
/// <para> /// <para>
@ -109,6 +109,18 @@ namespace WebSocketSharp
} }
} }
/// <summary>
/// Gets a value indicating whether the message type is ping.
/// </summary>
/// <value>
/// <c>true</c> if the message type is ping; otherwise, <c>false</c>.
/// </value>
public bool IsPing {
get {
return _opcode == Opcode.Ping;
}
}
/// <summary> /// <summary>
/// Gets a value indicating whether the message type is text. /// Gets a value indicating whether the message type is text.
/// </summary> /// </summary>
@ -134,11 +146,12 @@ namespace WebSocketSharp
} }
/// <summary> /// <summary>
/// Gets the type of the message. /// Gets the message type.
/// </summary> /// </summary>
/// <value> /// <value>
/// <see cref="Opcode.Text"/>, <see cref="Opcode.Binary"/>, or <see cref="Opcode.Ping"/>. /// <see cref="Opcode.Text"/>, <see cref="Opcode.Binary"/>, or <see cref="Opcode.Ping"/>.
/// </value> /// </value>
[Obsolete ("This property will be removed. Use any of the Is properties instead.")]
public Opcode Type { public Opcode Type {
get { get {
return _opcode; return _opcode;