Skip to content

Instantly share code, notes, and snippets.

@jymcheong
Created February 27, 2019 09:07
Show Gist options
  • Save jymcheong/c582a9c8e30304dedb5a8c4ea7bd2a80 to your computer and use it in GitHub Desktop.
Save jymcheong/c582a9c8e30304dedb5a8c4ea7bd2a80 to your computer and use it in GitHub Desktop.
WebSocket4Net example
using System;
using WebSocket4Net;
namespace websocket
{
class Program
{
static void Main(string[] args)
{
using (var ws = new WebSocket("ws://1.2.3.4:8080/"))
{
ws.MessageReceived += Ws_MessageReceived;
ws.Closed += Ws_Closed;
ws.Open();
Console.ReadKey(true);
}
}
private static void Ws_Closed(object sender, EventArgs e)
{
Console.WriteLine("server closed");
}
private static void Ws_MessageReceived(object sender, MessageReceivedEventArgs e)
{
Console.WriteLine("Server said: " + e.Message);
}
}
}
@jymcheong
Copy link
Author

Use Packet Manager Console/UI to add WebSocket4Net to the project first.

@reusoftware
Copy link

Hi have a food day,can you help me to find the solution on my problem,I creating a chat application,my problem is,I when I join chatroom,the chatroom showing captcha and need to submit captcha before joining,I don't know how to submit it,I can get the captcha result but I won't know how to submit it and join the chatroom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment