This project is read-only.

Basic Query on Sending of data from Websocket client to Server?

Dec 8, 2014 at 6:33 AM
thanks for the Websocket4net was very useful.
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);

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

Is it mandatory to send data on the Websocket_Opened event for first time? I am not able to send the data if I don't send in the Websocket_Opened event? Could some one throw light on simple query :)
Dec 22, 2014 at 7:32 AM
It doesn't mean you need send anything int the connection open event handler.

You must wait the connection open., and then you can send any data. The Open method of websocket is async.