From bf0f065f25d4b3fdf03f1ac20423c075fef82d2b Mon Sep 17 00:00:00 2001 From: sta Date: Thu, 5 Jun 2014 12:07:33 +0900 Subject: [PATCH] Added 'Query String' --- README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/README.md b/README.md index 93022a79..197f1579 100644 --- a/README.md +++ b/README.md @@ -470,6 +470,34 @@ If you would like to provide the Digest authentication, you should set like the wssv.AuthenticationSchemes = AuthenticationSchemes.Digest; ``` +### Query String ### + +As a **WebSocket Client**, if you would like to send the **Query String** with the WebSocket connection request to the server, you should create an instance of the `WebSocket` class with the WebSocket URL that includes the query string parameters. + +```cs +using (var ws = new WebSocket ("ws://example.com/?name=nobita")) { + ... +} +``` + +As a **WebSocket Server**, if you would like to get the **Query String** included in each WebSocket connection request, you should access the `WebSocketService.Context.QueryString` property, like the following. + +```cs +public class Chat : WebSocketService +{ + private string _name; + + ... + + protected override void OnOpen () + { + _name = Context.QueryString ["name"]; + } + + ... +} +``` + ### Origin header and Cookies ### As a **WebSocket Client**, if you would like to send the **Origin header** with the WebSocket connection request to the server, you should set the `WebSocket.Origin` property to an allowable value as the [Origin header] before connecting, like the following.