You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
525
+
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.
526
526
527
527
```csharp
528
528
ws.Origin="http://example.com";
529
529
```
530
530
531
-
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.
531
+
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.
532
532
533
533
```csharp
534
534
ws.SetCookie (newCookie ("name", "nobita"));
@@ -551,30 +551,31 @@ public class Chat : WebSocketBehavior
551
551
}
552
552
```
553
553
554
-
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.
555
-
556
-
If you would like to get the cookies included in a handshake request, you should access the `WebSocketBehavior.Context.CookieCollection` property.
557
-
558
554
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, Action<TBehavior>)` method with initializing, such as the following.
559
555
560
556
```csharp
561
557
wssv.AddWebSocketService<Chat> (
562
558
"/Chat",
563
559
s=> {
564
-
s.OriginValidator=val=> {
560
+
s.OriginValidator=
561
+
val=> {
565
562
// Check the value of the Origin header, and return true if valid.
0 commit comments