diff --git a/websocket-sharp/WebSocket.cs b/websocket-sharp/WebSocket.cs index 3b6619da8..07708bbf7 100644 --- a/websocket-sharp/WebSocket.cs +++ b/websocket-sharp/WebSocket.cs @@ -420,6 +420,11 @@ public NetworkCredential Credentials { } } + /// + /// Gets or sets the custom headers + /// + public IEnumerable> CustomHeaders { get; set; } + /// /// Gets or sets a value indicating whether a event /// is emitted when a ping is received. @@ -1419,6 +1424,11 @@ private HttpRequest createHandshakeRequest () if (_cookies.Count > 0) ret.SetCookies (_cookies); + if (CustomHeaders != null) + foreach (var header in CustomHeaders) + if (!headers.Contains(header.Key)) + ret.Headers[header.Key] = header.Value; + return ret; }