Demo Code:

using WebSocket4Net;
 
WebSocket websocket = new WebSocket("ws://localhost:2012/");
websocket.Opened += new EventHandler(websocket_Opened);
websocket.Error += new EventHandler<ErrorEventArgs>(websocket_Error);
websocket.Closed += new EventHandler(websocket_Closed);
websocket.MessageReceived += new EventHandler(websocket_MessageReceived);
websocket.Open();

private void websocket_Opened(object sender, EventArgs e)
{
     websocket.Send("Hello World!");
}

Last edited Mar 12, 2012 at 3:31 AM by kerryjiang, version 1

Comments

sbsummer Sep 11, 2014 at 2:41 PM 
It's not work when a large data sent to server.

wangwengang333 Sep 3, 2013 at 3:00 AM 
very good.