Fix for pull request #113
This commit is contained in:
parent
58a4f02bda
commit
f99112fc2f
@ -63,6 +63,8 @@ namespace Example2
|
||||
"/Chat",
|
||||
() => new Chat ("Anon#") {
|
||||
Protocol = "chat",
|
||||
// To emit a WebSocket.OnMessage event when receives a Ping.
|
||||
EmitOnPing = true,
|
||||
// To ignore the Sec-WebSocket-Extensions header.
|
||||
IgnoreExtensions = true,
|
||||
// To validate the Origin header.
|
||||
|
@ -90,6 +90,8 @@ namespace Example3
|
||||
"/Chat",
|
||||
() => new Chat ("Anon#") {
|
||||
Protocol = "chat",
|
||||
// To emit a WebSocket.OnMessage event when receives a Ping.
|
||||
EmitOnPing = true,
|
||||
// To ignore the Sec-WebSocket-Extensions header.
|
||||
IgnoreExtensions = true,
|
||||
// To validate the Origin header.
|
||||
|
@ -46,6 +46,7 @@ namespace WebSocketSharp.Server
|
||||
|
||||
private WebSocketContext _context;
|
||||
private Func<CookieCollection, CookieCollection, bool> _cookiesValidator;
|
||||
private bool _emitOnPing;
|
||||
private string _id;
|
||||
private bool _ignoreExtensions;
|
||||
private Func<string, bool> _originValidator;
|
||||
@ -145,6 +146,29 @@ namespace WebSocketSharp.Server
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the <see cref="WebSocket"/> used in a session emits
|
||||
/// a <see cref="WebSocket.OnMessage"/> event when receives a Ping.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <c>true</c> if the <see cref="WebSocket"/> emits a <see cref="WebSocket.OnMessage"/> event
|
||||
/// when receives a Ping; otherwise, <c>false</c>. The default value is <c>false</c>.
|
||||
/// </value>
|
||||
public bool EmitOnPing {
|
||||
get {
|
||||
return _websocket != null ? _websocket.EmitOnPing : _emitOnPing;
|
||||
}
|
||||
|
||||
set {
|
||||
if (_websocket != null) {
|
||||
_websocket.EmitOnPing = value;
|
||||
return;
|
||||
}
|
||||
|
||||
_emitOnPing = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the unique ID of a session.
|
||||
/// </summary>
|
||||
@ -329,6 +353,7 @@ namespace WebSocketSharp.Server
|
||||
|
||||
_websocket = context.WebSocket;
|
||||
_websocket.CustomHandshakeRequestChecker = checkIfValidConnectionRequest;
|
||||
_websocket.EmitOnPing = _emitOnPing;
|
||||
_websocket.IgnoreExtensions = _ignoreExtensions;
|
||||
_websocket.Protocol = _protocol;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user