All Projects → statianzo → Fleck

statianzo / Fleck

Licence: mit
C# Websocket Implementation

Programming Languages

C#
18002 projects
HTML
75241 projects

Projects that are alternatives of or similar to Fleck

Rubberduck
Every programmer needs a rubberduck. COM add-in for the VBA & VB6 IDE (VBE).
Stars: ✭ 1,287 (-31.14%)
Mutual labels:  hacktoberfest, dot-net
Home Panel
A web frontend for controlling the home.
Stars: ✭ 185 (-90.1%)
Mutual labels:  hacktoberfest, websocket
Skiasharp
SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library. It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
Stars: ✭ 2,493 (+33.39%)
Mutual labels:  hacktoberfest, dot-net
Django Sockpuppet
Build reactive applications with the django tooling you already know and love.
Stars: ✭ 225 (-87.96%)
Mutual labels:  hacktoberfest, websocket
Vue Crud X
Vue+Express Cookbook & CRUD Component (with Vite and Web Components)
Stars: ✭ 393 (-78.97%)
Mutual labels:  hacktoberfest, websocket
Ccxws
WebSocket client for 38 cryptocurrency exchanges
Stars: ✭ 341 (-81.75%)
Mutual labels:  hacktoberfest, websocket
Mercure
Server-sent live updates: protocol and reference implementation
Stars: ✭ 2,608 (+39.54%)
Mutual labels:  hacktoberfest, websocket
Akka Http
The Streaming-first HTTP server/module of Akka
Stars: ✭ 1,163 (-37.77%)
Mutual labels:  hacktoberfest, websocket
Statiq.web
Statiq Web is a flexible static site generator written in .NET.
Stars: ✭ 1,358 (-27.34%)
Mutual labels:  hacktoberfest, dot-net
Mattermost Bot Sample Golang
Stars: ✭ 140 (-92.51%)
Mutual labels:  hacktoberfest
Matrixprofile
A Python 3 library making time series data mining tasks, utilizing matrix profile algorithms, accessible to everyone.
Stars: ✭ 141 (-92.46%)
Mutual labels:  hacktoberfest
Notion Enhancer
an enhancer/customiser for the all-in-one productivity workspace notion.so (app)
Stars: ✭ 3,114 (+66.61%)
Mutual labels:  hacktoberfest
404 Pagenotfound
💥 A curated list of "404 Page Not Found" pages
Stars: ✭ 140 (-92.51%)
Mutual labels:  hacktoberfest
Activelogin.authentication
Support Swedish BankID (svenskt BankID) authentication in .NET.
Stars: ✭ 141 (-92.46%)
Mutual labels:  hacktoberfest
Awesome Vehicle Security
🚗 A curated list of resources for learning about vehicle security and car hacking.
Stars: ✭ 1,931 (+3.32%)
Mutual labels:  hacktoberfest
Di
PSR-11 compatible DI container and injector
Stars: ✭ 141 (-92.46%)
Mutual labels:  hacktoberfest
Pueue
🌠 Manage your shell commands.
Stars: ✭ 2,471 (+32.21%)
Mutual labels:  hacktoberfest
Gosu
2D game development library for Ruby and C++
Stars: ✭ 1,762 (-5.72%)
Mutual labels:  hacktoberfest
Zenrpc
JSON-RPC 2.0 Server Implementation with SMD support written in Go (go generate)
Stars: ✭ 140 (-92.51%)
Mutual labels:  websocket
Functional Promises
Write code like a story w/ a powerful Fluent (function chaining) API
Stars: ✭ 141 (-92.46%)
Mutual labels:  hacktoberfest

Fleck

Build status NuGet

Fleck is a WebSocket server implementation in C#. Branched from the Nugget project, Fleck requires no inheritance, container, or additional references.

Fleck has no dependency on HttpListener or HTTP.sys meaning that it will work on Windows 7 and Server 2008 hosts. WebSocket Remarks - Microsoft Docs

Example

The following is an example that will echo to a client.

var server = new WebSocketServer("ws://0.0.0.0:8181");
server.Start(socket =>
{
  socket.OnOpen = () => Console.WriteLine("Open!");
  socket.OnClose = () => Console.WriteLine("Close!");
  socket.OnMessage = message => socket.Send(message);
});
        

Supported WebSocket Versions

Fleck supports several WebSocket versions of modern web browsers

  • Hixie-Draft-76/Hybi-00 (Safari 5, Chrome < 14, Firefox 4 (when enabled))
  • Hybi-07 (Firefox 6)
  • Hybi-10 (Chrome 14-16, Firefox 7)
  • Hybi-13 (Chrome 17+, Firefox 11+, Safari 6+, Edge 13+(?))

Secure WebSockets (wss://)

Enabling secure connections requires two things: using the scheme wss instead of ws, and pointing Fleck to an x509 certificate containing a public and private key

var server = new WebSocketServer("wss://0.0.0.0:8431");
server.Certificate = new X509Certificate2("MyCert.pfx");
server.Start(socket =>
{
  //...use as normal
});

Having issues making a certificate? See this guide to creating an x509 by @AdrianBathurst

SubProtocol Negotiation

To enable negotiation of subprotocols, specify the supported protocols on the WebSocketServer.SupportedSubProtocols property. The negotiated subprotocol will be available on the socket's ConnectionInfo.NegotiatedSubProtocol.

If no supported subprotocols are found on the client request (the Sec-WebSocket-Protocol header), the connection will be closed.

var server = new WebSocketServer("ws://0.0.0.0:8181");
server.SupportedSubProtocols = new []{ "superchat", "chat" };
server.Start(socket =>
{
  //socket.ConnectionInfo.NegotiatedSubProtocol is populated
});

Custom Logging

Fleck can log into Log4Net or any other third party logging system. Just override the FleckLog.LogAction property with the desired behavior.

ILog logger = LogManager.GetLogger(typeof(FleckLog));

FleckLog.LogAction = (level, message, ex) => {
  switch(level) {
    case LogLevel.Debug:
      logger.Debug(message, ex);
      break;
    case LogLevel.Error:
      logger.Error(message, ex);
      break;
    case LogLevel.Warn:
      logger.Warn(message, ex);
      break;
    default:
      logger.Info(message, ex);
      break;
  }
};

Disable Nagle's Algorithm

Set NoDelay to true on the WebSocketConnection.ListenerSocket

var server = new WebSocketServer("ws://0.0.0.0:8181");
server.ListenerSocket.NoDelay = true;
server.Start(socket =>
{
  //Child connections will not use Nagle's Algorithm
});

Auto Restart After Listen Error

Set RestartAfterListenError to true on the WebSocketConnection

var server = new WebSocketServer("ws://0.0.0.0:8181");
server.RestartAfterListenError = true;
server.Start(socket =>
{
  //...use as normal
});
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].