|
SimpleWebSocketServer Library
v1.0.1
A simple to use websocket with a very easy way to get it to work, just requires four lines of code.
|
Middleware class for interfacing with the WebSocketHandler and WebSocketHttpServer class. More...
Collaboration diagram for SimpleWebSocketServerLibrary.SimpleWebSocketServer:Public Member Functions | |
| SimpleWebSocketServer (SimpleWebSocketServerSettings settings) | |
| Constructor for setting up the Library. More... | |
| SimpleWebSocketServer () | |
| Overload constructor for setting up library with default values. More... | |
| async Task | StartServerAsync () |
| Starts running the server async. More... | |
| void | StartServer () |
| Starts running the server async. More... | |
| async Task< bool > | SendTextMessageAsync (string messageToSend, string clientId=null) |
| Overload method for sending text messages to a specific client, using it's id, asynchronous. More... | |
| bool | SendTextMessage (string messageToSend, string clientId=null) |
| Overload method for sending text messages to a specific client, using it's id, synchronous. More... | |
| async Task< bool > | SendBinaryMessageAsync (byte[] messageToSend, string clientId=null) |
| Sends a binary "message" to a specific client asynchronous. More... | |
| bool | SendBinaryMessage (byte[] messageToSend, string clientId=null) |
| Sends a binary "message" to a specific client synchronous. More... | |
| async Task< bool > | SendPingMessageAsync (string messageToSend="", string clientId=null) |
| Sends a ping message to all clients asynchronous, can have message. More... | |
| bool | SendPingMessage (string messageToSend="", string clientId=null) |
| Sends a ping message to all clients synchronous, can have message. More... | |
| async Task< bool > | SendPongMessageAsync (string messageToSend="", string clientId=null) |
| Send pong message to all available clients asynchronous, can have message. More... | |
| bool | SendPongMessage (string messageToSend="", string clientId=null) |
| Send pong message to all available clients synchronous, can have message. More... | |
| async Task< bool > | StopClientAsync (string clientId, string reason="") |
| Stops a connection with a specific client asynchronous. Can provide reason. More... | |
| bool | StopClient (string clientId, string reason="") |
| Stops a connection with a specific client synchronous. Can provide reason. More... | |
| async Task< bool > | StopAllAsync (string reason="") |
| Stops all connections with all clients asynchronous. Can provide reason. More... | |
| bool | StopAll (string reason="") |
| Stops all connections with all clients synchronous. Can provide reason. More... | |
Events | |
| EventHandler< WebSocketEventArg > | WebsocketServerEvent |
| Eventhandler for when events such as receiving messages and errors from the websocket server happen. More... | |
Private Member Functions | |
| void | OnWebsocketServerEvent (object sender, WebSocketEventArg arg) |
| Event handler for receiving websocket messages from the websocket handler. More... | |
Private Attributes | |
| readonly IWebSocketHandler | _WebsocketHandler |
| Interface for the WebSocketHandler class. More... | |
| readonly IWebSocketHttpServer | _WebSocketHttpServer |
| Interface for the WebSocketHttpServer class. More... | |
Middleware class for interfacing with the WebSocketHandler and WebSocketHttpServer class.
Definition at line 12 of file SimpleWebsocketServer.cs.
| SimpleWebSocketServerLibrary.SimpleWebSocketServer.SimpleWebSocketServer | ( | SimpleWebSocketServerSettings | settings | ) |
Constructor for setting up the Library.
| settings | Settings with default values. |
Definition at line 33 of file SimpleWebsocketServer.cs.
Here is the call graph for this function:| SimpleWebSocketServerLibrary.SimpleWebSocketServer.SimpleWebSocketServer | ( | ) |
Overload constructor for setting up library with default values.
Definition at line 43 of file SimpleWebsocketServer.cs.
|
private |
Event handler for receiving websocket messages from the websocket handler.
| sender | Instance of firing class. |
| arg | Arguments for event. |
Definition at line 50 of file SimpleWebsocketServer.cs.
Here is the caller graph for this function:| bool SimpleWebSocketServerLibrary.SimpleWebSocketServer.SendBinaryMessage | ( | byte [] | messageToSend, |
| string | clientId = null |
||
| ) |
Sends a binary "message" to a specific client synchronous.
| messageToSend | Message in binary format (byte array). |
| clientId | Client to send to. |
Definition at line 144 of file SimpleWebsocketServer.cs.
Here is the call graph for this function:| async Task<bool> SimpleWebSocketServerLibrary.SimpleWebSocketServer.SendBinaryMessageAsync | ( | byte [] | messageToSend, |
| string | clientId = null |
||
| ) |
Sends a binary "message" to a specific client asynchronous.
| messageToSend | Message in binary format (byte array). |
| clientId | Client to send to. |
Definition at line 122 of file SimpleWebsocketServer.cs.
Here is the call graph for this function:| bool SimpleWebSocketServerLibrary.SimpleWebSocketServer.SendPingMessage | ( | string | messageToSend = "", |
| string | clientId = null |
||
| ) |
Sends a ping message to all clients synchronous, can have message.
| messageToSend | Possible extra message to send along ping. |
| clientId | Set clientId in case you want to send to a specific client. |
Definition at line 187 of file SimpleWebsocketServer.cs.
Here is the call graph for this function:| async Task<bool> SimpleWebSocketServerLibrary.SimpleWebSocketServer.SendPingMessageAsync | ( | string | messageToSend = "", |
| string | clientId = null |
||
| ) |
Sends a ping message to all clients asynchronous, can have message.
| messageToSend | Possible extra message to send along ping. |
| clientId | Set clientId in case you want to send to a specific client. |
Definition at line 166 of file SimpleWebsocketServer.cs.
Here is the call graph for this function:| bool SimpleWebSocketServerLibrary.SimpleWebSocketServer.SendPongMessage | ( | string | messageToSend = "", |
| string | clientId = null |
||
| ) |
Send pong message to all available clients synchronous, can have message.
| messageToSend | Possible extra message to send along ping. |
| clientId | Set clientId in case you want to send to a specific client. |
Definition at line 229 of file SimpleWebsocketServer.cs.
Here is the call graph for this function:| async Task<bool> SimpleWebSocketServerLibrary.SimpleWebSocketServer.SendPongMessageAsync | ( | string | messageToSend = "", |
| string | clientId = null |
||
| ) |
Send pong message to all available clients asynchronous, can have message.
| messageToSend | Possible extra message to send along ping. |
| clientId | Set clientId in case you want to send to a specific client. |
Definition at line 208 of file SimpleWebsocketServer.cs.
Here is the call graph for this function:| bool SimpleWebSocketServerLibrary.SimpleWebSocketServer.SendTextMessage | ( | string | messageToSend, |
| string | clientId = null |
||
| ) |
Overload method for sending text messages to a specific client, using it's id, synchronous.
| messageToSend | |
| clientId |
Definition at line 99 of file SimpleWebsocketServer.cs.
Here is the call graph for this function:| async Task<bool> SimpleWebSocketServerLibrary.SimpleWebSocketServer.SendTextMessageAsync | ( | string | messageToSend, |
| string | clientId = null |
||
| ) |
Overload method for sending text messages to a specific client, using it's id, asynchronous.
| messageToSend | |
| clientId |
Definition at line 77 of file SimpleWebsocketServer.cs.
Here is the call graph for this function:| void SimpleWebSocketServerLibrary.SimpleWebSocketServer.StartServer | ( | ) |
Starts running the server async.
Definition at line 66 of file SimpleWebsocketServer.cs.
Here is the call graph for this function:| async Task SimpleWebSocketServerLibrary.SimpleWebSocketServer.StartServerAsync | ( | ) |
Starts running the server async.
Definition at line 58 of file SimpleWebsocketServer.cs.
Here is the call graph for this function:| bool SimpleWebSocketServerLibrary.SimpleWebSocketServer.StopAll | ( | string | reason = "" | ) |
Stops all connections with all clients synchronous. Can provide reason.
| reason | Possible reason to close the connection. |
Definition at line 303 of file SimpleWebsocketServer.cs.
Here is the call graph for this function:| async Task<bool> SimpleWebSocketServerLibrary.SimpleWebSocketServer.StopAllAsync | ( | string | reason = "" | ) |
Stops all connections with all clients asynchronous. Can provide reason.
| reason | Possible reason to close the connection. |
Definition at line 286 of file SimpleWebsocketServer.cs.
Here is the call graph for this function:| bool SimpleWebSocketServerLibrary.SimpleWebSocketServer.StopClient | ( | string | clientId, |
| string | reason = "" |
||
| ) |
Stops a connection with a specific client synchronous. Can provide reason.
| clientId | Specific client to close connection with. |
| reason | Possible reason to close the connection. |
Definition at line 268 of file SimpleWebsocketServer.cs.
Here is the call graph for this function:| async Task<bool> SimpleWebSocketServerLibrary.SimpleWebSocketServer.StopClientAsync | ( | string | clientId, |
| string | reason = "" |
||
| ) |
Stops a connection with a specific client asynchronous. Can provide reason.
| clientId | Specific client to close connection with. |
| reason | Possible reason to close the connection. |
Definition at line 250 of file SimpleWebsocketServer.cs.
Here is the call graph for this function:
|
private |
Interface for the WebSocketHandler class.
Definition at line 17 of file SimpleWebsocketServer.cs.
|
private |
Interface for the WebSocketHttpServer class.
Definition at line 21 of file SimpleWebsocketServer.cs.
| EventHandler<WebSocketEventArg> SimpleWebSocketServerLibrary.SimpleWebSocketServer.WebsocketServerEvent |
Eventhandler for when events such as receiving messages and errors from the websocket server happen.
Definition at line 27 of file SimpleWebsocketServer.cs.