Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A socket abstraction solution as part of the .NET eco system #29140

Closed
KieranDevvs opened this issue Jan 8, 2021 · 5 comments
Closed

A socket abstraction solution as part of the .NET eco system #29140

KieranDevvs opened this issue Jan 8, 2021 · 5 comments
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Milestone

Comments

@KieranDevvs
Copy link

KieranDevvs commented Jan 8, 2021

Currently there is no nice way to create a high performance socket server / client without having to write your own boilerplate for connection handling, error handling, frame encoding and decoding etc. Async sockets are especially a pain to deal with as the API's seem to follow an old async convention.

I know https://github.com/davidfowl/BedrockFramework/ exists, which is now apart of Kestrel, but the whole situation is unclear as documentation is lacking in this area. Is the plan to inject the whole of Kestrel?

I guess my desired end goal is to have something like https://netty.io/ for .NET

@halter73 halter73 added the Docs This issue tracks updating documentation label Jan 8, 2021
@halter73 halter73 added this to the Backlog milestone Jan 8, 2021
@ghost
Copy link

ghost commented Jan 8, 2021

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@halter73
Copy link
Member

halter73 commented Jan 8, 2021

You can take a look https://github.com/redhat-developer/kestrel-linux-transport to see how another custom transport integrates with Kestrel. You're right that we're currently lacking docs in this area.

We're considering transitioning to a shared transport abstraction with HttpClient in .NET 6 (see dotnet/runtime#1793) which would be a new API.

@KieranDevvs
Copy link
Author

KieranDevvs commented Jan 9, 2021

You can take a look https://github.com/redhat-developer/kestrel-linux-transport to see how another custom transport integrates with Kestrel. You're right that we're currently lacking docs in this area.

We're considering transitioning to a shared transport abstraction with HttpClient in .NET 6 (see dotnet/runtime#1793) which would be a new API.

Im confused... The first line of this issue regarding ProjectBedrock states that the whole purpose of it was to decouple the network stack from kestrel to be used in different types of applications.

Project bedrock is about further decoupling the components of Kestrel so that we can use it as the foundation for our non-http networking stack.

Yet this issue is closed because "the core of Bedrock is within Kestrel":

Closing this because the core of bedrock is in Kestrel. We still have a number of reactions we want to make (#4623 for example) but those should be tracked in separate issues.

What is the intended usage of this abstract network stack?
A) Bedrock is its own library and should be imported by the end user.
B) Kestrel now contains the Bedrock library and thus end users should import the whole of Kestrel to use it.
C) System.Net.Connections API
D) None of the above?

If the answer is B, it seems overkill to import the whole of Kestrel for my intended use.

@davidfowl davidfowl removed Docs This issue tracks updating documentation area-servers labels Jan 9, 2021
@davidfowl
Copy link
Member

There's layers to this answer. Today Kestrel has a public API that makes it possible to write networking applications (I assume that's why the docs label was added to this question). It's based on the abstractions in Microsoft.AspNetCore.Connections. We'd like to replace the abstractions with the ones defined in dotnet/runtime#1793 and introduce a few implementations (sockets based etc).

The current state of https://github.com/davidfowl/BedrockFramework/ today is that it is built based on those same primitives and exposes a more higher level abstractions for implementing protocols in an efficient way. Bedrock is currently a side project that I don't expect will make its way back into the core platform, but will be built on the same primitives.

Speaking as myself now I do have plans to re-invest in the bedrock project and ship a pre-release to nuget.

@sec
Copy link
Contributor

sec commented Jan 29, 2022

Hi,
@davidfowl Any update on this one? I've also been looking forward to use Kestrel as non-http server (I want to have something like TcpListener with TLS, but using Kestrel as base). Right now I've started with UseConnectionHandler and ConnectionHandler as initial implementation (with .UseHttps), but maybe there's some better/clever way of doing that?

For ex. how to get client certificate inside OnConnectedAsync?

@ghost ghost locked as resolved and limited conversation to collaborators Jan 29, 2023
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Aug 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Projects
None yet
Development

No branches or pull requests

7 participants