
Security News
New CVE Forecasting Tool Predicts 47,000 Disclosures in 2025
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
WatsonWebsocket is the EASIEST and FASTEST way to build client and server applications that rely on messaging using websockets. It's. Really. Easy.
WatsonWebsocket is the EASIEST and FASTEST way to build client and server applications that rely on messaging using websockets. It's. Really. Easy.
Many thanks and much appreciation to those that take the time to make this library better!
@BryanCrotaz @FodderMK @caozero @Danatobob @Data33 @AK5nowman @jjxtra @MartyIX @rajeshdua123 @tersers @MacKey-255 @KRookoo1 @joreg @ilsnk @xbarra @mawkish00 @jlopvet @marco-manfroni-perugiatiming @GiaNTizmO @exergist @ebarale99 @WarstekHUN @Rubidium37 @codengine @berkut0
A test project for both client (TestClient
) and server (TestServer
) are included which will help you understand and exercise the class library.
A test project that spawns a server and client and exchanges messages can be found here: https://github.com/jchristn/watsonwebsockettest
WatsonWebsocket currently relies on websocket support being present in the underlying operating system. Windows 7 does not support websockets.
SSL is supported in WatsonWebsocket. The constructors for WatsonWsServer
and WatsonWsClient
accept a bool
indicating whether or not SSL should be enabled. Since websockets, and as a byproduct WatsonWebsocket, use HTTPS, they rely on certificates within the certificate store of your operating system. A test certificate is provided in both the TestClient
and TestServer
projects which can be used for testing purposes. These should NOT be used in production.
For more information on using SSL certificates, please refer to the wiki.
Guid
in ClientMetadata
ListClients
now returns full ClientMetadata
Send*
methods now take guid
as opposed to IpPort
using WatsonWebsocket;
WatsonWsServer server = new WatsonWsServer("[ip]", port, true|false);
server.ClientConnected += ClientConnected;
server.ClientDisconnected += ClientDisconnected;
server.MessageReceived += MessageReceived;
server.Start();
static void ClientConnected(object sender, ConnectionEventArgs args)
{
Console.WriteLine("Client connected: " + args.Client.ToString());
}
static void ClientDisconnected(object sender, DisconnectionEventArgs args)
{
Console.WriteLine("Client disconnected: " + args.Client.ToString());
}
static void MessageReceived(object sender, MessageReceivedEventArgs args)
{
Console.WriteLine("Message received from " + args.Client.ToString() + ": " + Encoding.UTF8.GetString(args.Data));
}
using WatsonWebsocket;
WatsonWsClient client = new WatsonWsClient("[server ip]", [server port], true|false);
client.ServerConnected += ServerConnected;
client.ServerDisconnected += ServerDisconnected;
client.MessageReceived += MessageReceived;
client.Start();
static void MessageReceived(object sender, MessageReceivedEventArgs args)
{
Console.WriteLine("Message from server: " + Encoding.UTF8.GetString(args.Data));
}
static void ServerConnected(object sender, EventArgs args)
{
Console.WriteLine("Server connected");
}
static void ServerDisconnected(object sender, EventArgs args)
{
Console.WriteLine("Server disconnected");
}
server = new WatsonWsServer("http://localhost:9000/");
server.Start();
let socket = new WebSocket("ws://localhost:9000/test/");
socket.onopen = function () { console.log("success"); };
socket.onmessage = function (msg) { console.log(msg.data); };
socket.onclose = function () { console.log("closed"); };
// wait a moment
socket.send("Hello, world!");
When you configure WatsonWebsocket to listen on 127.0.0.1
or localhost
, it will only respond to requests received from within the local machine.
To configure access from other nodes outside of localhost
, use the following:
*
or +
. You MUST:
127.0.0.1
, you MAY need to run as administrator (this is operating system dependent)netsh
command:
netsh http show urlacl
netsh http add urlacl url=http://[hostname]:[port]/ user=everyone listen=yes
hostname
and port
are the values you are using in the constructorPlease refer to CHANGELOG.md for details.
FAQs
WatsonWebsocket is the EASIEST and FASTEST way to build client and server applications that rely on messaging using websockets. It's. Really. Easy.
We found that watsonwebsocket demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.