All Projects → jchristn → WatsonWebsocket

jchristn / WatsonWebsocket

Licence: MIT license
A simple C# async websocket server and client for reliable transmission and receipt of data

Programming Languages

C#
18002 projects
Batchfile
5799 projects

Projects that are alternatives of or similar to WatsonWebsocket

WatsonCluster
A simple C# class using Watson TCP to enable a one-to-one high availability cluster.
Stars: ✭ 18 (-88.61%)
Mutual labels:  watson, nuget, messaging, message
Watsontcp
WatsonTcp is the easiest way to build TCP-based clients and servers in C#.
Stars: ✭ 209 (+32.28%)
Mutual labels:  nuget, messaging, rpc
Simpletcp
Simple wrapper for TCP client and server in C# with SSL support
Stars: ✭ 99 (-37.34%)
Mutual labels:  messaging, rpc
Applozic Ios Sdk
iOS Real Time Chat & Messaging SDK
Stars: ✭ 104 (-34.18%)
Mutual labels:  messaging, message
Twitch Js
A community-centric, community-supported version of tmi.js
Stars: ✭ 225 (+42.41%)
Mutual labels:  messaging, message
Bigq
Messaging platform in C# for TCP and Websockets, with or without SSL
Stars: ✭ 18 (-88.61%)
Mutual labels:  messaging, message
Remit
RabbitMQ-backed microservices supporting RPC, pubsub, automatic service discovery and scaling with no code changes.
Stars: ✭ 24 (-84.81%)
Mutual labels:  messaging, rpc
Kekkonen
A remote (CQRS) API library for Clojure.
Stars: ✭ 201 (+27.22%)
Mutual labels:  messaging, rpc
whatsapp-bot
Made with Python and Selenium, can be used to send multiple messages and send messages as characters made of emojis
Stars: ✭ 34 (-78.48%)
Mutual labels:  messaging, message
Watsonwebserver
Watson is the fastest, easiest way to build scalable RESTful web servers and services in C#.
Stars: ✭ 125 (-20.89%)
Mutual labels:  watson, nuget
SimpleSockets
Asynchronous TCP .NET library with reliable transmission and receipt of data, with an ssl implementation.
Stars: ✭ 74 (-53.16%)
Mutual labels:  nuget, messaging
Messagekit
A community-driven replacement for JSQMessagesViewController
Stars: ✭ 5,036 (+3087.34%)
Mutual labels:  messaging, message
Rpc Websockets
JSON-RPC 2.0 implementation over WebSockets for Node.js and JavaScript/TypeScript
Stars: ✭ 344 (+117.72%)
Mutual labels:  messaging, rpc
Swiftychat
SwiftUI Chat UI (Client) Framework & Documentation to get started!
Stars: ✭ 50 (-68.35%)
Mutual labels:  messaging, message
Falconmessenger
🌟🌟🌟🌟🌟 Falcon Messenger is a Fast and Beautiful cloud-based messaging app. With iOS and IPadOS Support. Available on the App Store.
Stars: ✭ 310 (+96.2%)
Mutual labels:  messaging, message
Jsqmessagesviewcontroller
An elegant messages UI library for iOS
Stars: ✭ 11,240 (+7013.92%)
Mutual labels:  messaging, message
Masstransit
Distributed Application Framework for .NET
Stars: ✭ 4,103 (+2496.84%)
Mutual labels:  nuget, messaging
super-mario-message
Display custom messages in a Super Mario Bros environment
Stars: ✭ 18 (-88.61%)
Mutual labels:  messaging, message
SuperSimpleTcp
Simple wrapper for TCP client and server in C# with SSL support
Stars: ✭ 263 (+66.46%)
Mutual labels:  messaging, rpc
azure-event-hubs-go
Golang client library for Azure Event Hubs https://azure.microsoft.com/services/event-hubs
Stars: ✭ 80 (-49.37%)
Mutual labels:  messaging

alt tag

Watson Websocket

NuGet Version NuGet

WatsonWebsocket is the EASIEST and FASTEST way to build client and server applications that rely on messaging using websockets. It's. Really. Easy.

Thanks and Appreciation

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

Test App

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

Supported Operating Systems

WatsonWebsocket currently relies on websocket support being present in the underlying operating system. Windows 7 does not support websockets.

SSL

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.

New in v2.3.x

  • Minor breaking changes
  • Merge PR from @MacKey-255 with new enhancements
  • Send and wait APIs (SendAndWaitAsync)
  • Client connect with timeout API (StartWithTimeout and StartWithTimeoutAsync)
  • Multiple listener prefixes

Server Example

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, ClientConnectedEventArgs args) 
{
    Console.WriteLine("Client connected: " + args.IpPort);
}

static void ClientDisconnected(object sender, ClientDisconnectedEventArgs args) 
{
    Console.WriteLine("Client disconnected: " + args.IpPort);
}

static void MessageReceived(object sender, MessageReceivedEventArgs args) 
{ 
    Console.WriteLine("Message received from " + args.IpPort + ": " + Encoding.UTF8.GetString(args.Data));
}

Client Example

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");
}

Client Example using Browser

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!");

Accessing from Outside Localhost

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:

  • Specify the exact DNS hostname upon which WatsonWebsocket should listen in the Server constructor. The HOST header on incoming HTTP requests MUST match this value (this is an operating system limitation)
  • If you want to listen on more than one hostname or IP address, use * or +. You MUST:
    • Run WatsonWebsocket as administrator for this to work (this is an operating system limitation)
    • Use the server constructor that takes distinct hostname and port values (not the URI-based constructor)
  • If you want to use a port number less than 1024, you MUST run WatsonWebsocket as administrator (this is an operating system limitation)
  • If you listen on an interface IP address other than 127.0.0.1, you MAY need to run as administrator (this is operating system dependent)
  • Open a port on your firewall to permit traffic on the TCP port upon which WatsonWebsocket is listening
  • You may have to add URL ACLs, i.e. URL bindings, within the operating system using the netsh command:
    • Check for existing bindings using netsh http show urlacl
    • Add a binding using netsh http add urlacl url=http://[hostname]:[port]/ user=everyone listen=yes
    • Where hostname and port are the values you are using in the constructor
  • If you are using SSL, you will need to install the certificate in the certificate store and retrieve the thumbprint
  • If you're still having problems, please do not hesitate to file an issue here, and I will do my best to help and update the documentation.

Version History

Please refer to CHANGELOG.md for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].