Skip to content

duanyunlun/CSSockets

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CSSockets

A WIP implementation of event-based sockets for .NET Core 2.0. Includes highly scalable, wrapped TCP, low-level HTTP and raw WebSockets. Data handling is done with Node.js-inspired reinvented streams - see CSSockets.Streams. Designed to use the least amount of threads that deliver excellent performance. This is a shaky but functioning library - bug hunting is encouraged.

This project uses object-oriented programming to a large extent to enable heavy customization:

  • All streams inherit either interfaces directly or base classes.
  • TcpSocket is to be wrapped and accessed with events and stream methods, however the Socket behind it is exposed if you want to do magic.
  • All the base HTTP classes are made with generics (see CSSockets.Http.Base and CSSockets.Http.Reference) so you can even make your own HTTP version if you want to.

The performance focus is around parallelization of heavy workloads but with minimal cross-thread tampering:

  • All the BaseReadable, BaseWritable, UnifiedDuplex, BaseDuplex and Compressors stream implemenatations call further operations on the caller thread.
  • Accepted sockets made by CSSockets.Tcp.TcpSocket are handled with Socket.Select to ensure minimal thread usage.
  • Multiple socket I/O processor threads will be opened for more than 32 sockets.

Implementations:

  • Base stream classes
    • Readable
    • Writable
    • Duplex
    • Transform (UnifiedDuplex is capable of this)
  • TCP
    • Client
    • Server
  • HTTP
    • Base HTTP classes
      • Header
      • Version
      • Query tokens
      • Paths
    • Head parsing
      • Request head
      • Response head
    • Head serializing
      • Request head
      • Response head
    • Body parsing
      • Binary
      • Chunked
      • Compressed binary
      • Compressed chunked
    • Body serializing
      • Binary
      • Chunked
      • Compressed binary
      • Compressed chunked
    • HTTP connections
      • Client-side connection
      • Server-side connection
    • Support for custom upgrading
    • HTTP listener
  • WebSockets
    • Message parsing
    • Message serialization
    • WebSocket connections
      • Client-side connection
      • Server-side connection
    • Support for custom extensions
      • Implement permessage-deflate?
  • HTTPS?
  • Secure WebSockets?

About

A WIP implementation of event-based sockets for .NET Core 2.0

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%