[Modify] Edit it

This commit is contained in:
sta 2016-10-22 17:26:11 +09:00
parent 28cb4477bc
commit 1b5d84456c

View File

@ -540,13 +540,13 @@ As a WebSocket client, if you would like to send the query string in the handsha
var ws = new WebSocket ("ws://example.com/?name=nobita"); var ws = new WebSocket ("ws://example.com/?name=nobita");
``` ```
And if you would like to send the Origin header in the handshake request, you should set the `WebSocket.Origin` property to an allowable value as the [Origin] header before calling the connect method. If you would like to send the Origin header in the handshake request, you should set the `WebSocket.Origin` property to an allowable value as the [Origin] header before calling the connect method.
```csharp ```csharp
ws.Origin = "http://example.com"; ws.Origin = "http://example.com";
``` ```
And also if you would like to send the cookies in the handshake request, you should set any cookie by using the `WebSocket.SetCookie (WebSocketSharp.Net.Cookie)` method before calling the connect method. And if you would like to send the cookies in the handshake request, you should set any cookie by using the `WebSocket.SetCookie (WebSocketSharp.Net.Cookie)` method before calling the connect method.
```csharp ```csharp
ws.SetCookie (new Cookie ("name", "nobita")); ws.SetCookie (new Cookie ("name", "nobita"));
@ -569,9 +569,11 @@ public class Chat : WebSocketBehavior
} }
``` ```
And if you would like to get each value of the Origin header and cookies, you should access each of the `WebSocketBehavior.Context.Origin` and `WebSocketBehavior.Context.CookieCollection` properties. If you would like to get the value of the Origin header included in a handshake request, you should access the `WebSocketBehavior.Context.Origin` property.
And also if you would like to validate the Origin header, cookies, or both included in a handshake request, you should set each validation with your `WebSocketBehavior`, for example, by using the `WebSocketServer.AddWebSocketService<TBehavior> (string, Func<TBehavior>)` method with initializing, such as the following. If you would like to get the cookies included in a handshake request, you should access the `WebSocketBehavior.Context.CookieCollection` property.
And if you would like to validate the Origin header, cookies, or both, you should set each validation for it with your `WebSocketBehavior`, for example, by using the `WebSocketServer.AddWebSocketService<TBehavior> (string, Func<TBehavior>)` method with initializing, such as the following.
```csharp ```csharp
wssv.AddWebSocketService<Chat> ( wssv.AddWebSocketService<Chat> (