WebSocketEcho

This sample connects to a WebSocket server, sends "Hello!" message, receives and shows the response.

Usage

The sample is a console utility that accepts an optional argument that specifies the target URI.

> WebSocketEcho ws://echo.websocket.org/

C#

// create an instance of WebSocket client
var client = new WebSocketClient();

// connect to a server
client.Connect("ws://echo.websocket.org");

// send a message
client.Send("Hello!");

// receive response
string response = client.Receive<string>();

// display it
Console.WriteLine(response);