I am trying to send data from a C# form which I have stored in a variable called ClientMsg. I am using SocketIoClientDotNet to communicate to the node server. I have the connection setup which is all fine but I am unable to send data from the form to my server.
Could someone tell me how to do this as I cant find anything online?
Update (added code):
private void socketManager()
{
var server = IO.Socket("http://localhost");
server.On(Socket.EVENT_CONNECT, () =>
{
UpdateStatus("Connected");
});
server.On(Socket.EVENT_DISCONNECT, () =>
{
UpdateStatus("disconnected");
});
server.Emit("admin", ClientMsg);
}
Button:
private void btnSend_Click(object sender, EventArgs e)
{
String ClientMsg = txtSend.Text;
if (ClientMsg.Length == 0)
{
txtSend.Clear();
}
else
{
txtSend.Clear();
lstMsgs.Items.Add("You:" + " " + ClientMsg);
}
}