Refactored a few for README.md
This commit is contained in:
parent
dee36926ae
commit
98cee6e20e
14
README.md
14
README.md
@ -200,7 +200,7 @@ If you would like to connect to the server asynchronously, you should use the `W
|
|||||||
|
|
||||||
#### Step 5 ####
|
#### Step 5 ####
|
||||||
|
|
||||||
Sending a data to the WebSocket server.
|
Sending data to the WebSocket server.
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
ws.Send (data);
|
ws.Send (data);
|
||||||
@ -208,9 +208,9 @@ ws.Send (data);
|
|||||||
|
|
||||||
The `WebSocket.Send` method is overloaded.
|
The `WebSocket.Send` method is overloaded.
|
||||||
|
|
||||||
You can use the `WebSocket.Send (string)`, `WebSocket.Send (byte[])`, or `WebSocket.Send (System.IO.FileInfo)` method to send a data.
|
You can use the `WebSocket.Send (string)`, `WebSocket.Send (byte[])`, or `WebSocket.Send (System.IO.FileInfo)` method to send the data.
|
||||||
|
|
||||||
If you would like to send a data asynchronously, you should use the `WebSocket.SendAsync` method.
|
If you would like to send the data asynchronously, you should use the `WebSocket.SendAsync` method.
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
ws.SendAsync (data, completed);
|
ws.SendAsync (data, completed);
|
||||||
@ -329,15 +329,15 @@ public class Chat : WebSocketBehavior
|
|||||||
|
|
||||||
You can define the behavior of any WebSocket service by creating the class that inherits the `WebSocketBehavior` class.
|
You can define the behavior of any WebSocket service by creating the class that inherits the `WebSocketBehavior` class.
|
||||||
|
|
||||||
If you override the `WebSocketBehavior.OnMessage (MessageEventArgs)` method, it's called when the `WebSocket` used in the current session in the service receives a message.
|
If you override the `WebSocketBehavior.OnMessage (MessageEventArgs)` method, it's called when the `WebSocket` used in a session in the service receives a message.
|
||||||
|
|
||||||
And if you override the `WebSocketBehavior.OnOpen ()`, `WebSocketBehavior.OnError (ErrorEventArgs)`, and `WebSocketBehavior.OnClose (CloseEventArgs)` methods, each of them is called when each event of the `WebSocket` (the `OnOpen`, `OnError`, and `OnClose` events) occurs.
|
And if you override the `WebSocketBehavior.OnOpen ()`, `WebSocketBehavior.OnError (ErrorEventArgs)`, and `WebSocketBehavior.OnClose (CloseEventArgs)` methods, each of them is called when each event of the `WebSocket` (the `OnOpen`, `OnError`, and `OnClose` events) occurs.
|
||||||
|
|
||||||
The `WebSocketBehavior.Send` method sends a data to the client on the current session in the service.
|
The `WebSocketBehavior.Send` method sends data to the client on a session in the service.
|
||||||
|
|
||||||
If you would like to access the sessions in the service, you should use the `WebSocketBehavior.Sessions` property (returns a `WebSocketSharp.Server.WebSocketSessionManager`).
|
If you would like to access the sessions in the service, you should use the `WebSocketBehavior.Sessions` property (returns a `WebSocketSharp.Server.WebSocketSessionManager`).
|
||||||
|
|
||||||
The `WebSocketBehavior.Sessions.Broadcast` method broadcasts a data to every client in the service.
|
The `WebSocketBehavior.Sessions.Broadcast` method sends data to every client in the service.
|
||||||
|
|
||||||
#### Step 3 ####
|
#### Step 3 ####
|
||||||
|
|
||||||
@ -446,7 +446,7 @@ If you set this property to nothing, the validation does nothing with the server
|
|||||||
As a **WebSocket Server**, you should create a new instance of the `WebSocketServer` or `HttpServer` class with some settings for secure connection, such as the following.
|
As a **WebSocket Server**, you should create a new instance of the `WebSocketServer` or `HttpServer` class with some settings for secure connection, such as the following.
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
var wssv = new WebSocketServer (4649, true);
|
var wssv = new WebSocketServer (5963, true);
|
||||||
wssv.SslConfiguration.ServerCertificate =
|
wssv.SslConfiguration.ServerCertificate =
|
||||||
new X509Certificate2 ("/path/to/cert.pfx", "password for cert.pfx");
|
new X509Certificate2 ("/path/to/cert.pfx", "password for cert.pfx");
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user