13 ms·
As part of my first couple of months of work at Deno, I wrote the new Deno.serve implementation that's being stabilized here. It's based on a thread-local slab
by mmastrac 3y ago
As part of my first couple of months of work at Deno, I wrote the new Deno.serve implementation that's being stabilized here. It's based on a thread-local slab that is wired into Hyper 1.0 (which is an amazing Rust webserver and nearing release).
This gave us solid support for HTTP/2 in Deno itself -- you can start a full webserver on a TLS socket and start talking fully-compliant HTTP/2 in just a couple of lines.
It's an interesting challenge to get this to cooperate with V8 in a performance way and we're continuing to work on it while keeping the code as maintainable as possible. The implementation will continue to evolve as we design better and faster interfaces between Rust and V8. The cool thing is that this is all going into open-source projects, either in Deno itself, rusty_v8 or V8 itself.
Happy to answer any questions.
- galaxyLogic 3y agoSo how do I get the SSL certificate in there, does it come with it?
- tomxor 3y agoI found this: https://deno.land/manual@v1.35.0/runtime/http_server_apis#https-support https://deno.land/manual@v1.35.0/runtime/http_server_apis#ht...
- mmastrac 3y agoI would personally use letsencrypt and then pass the cert/key into the Deno.serve call, though I am curious now if there is a more integrated solution and I'm going to dig into it a bit.
- vbezhenar 3y agoUse Caddy.
- Aerbil313 3y agoYes, I too am too lazy to learn nginx, certbot or whatever those things are as well. Edit: I really am. Why downvote?
- philosopher1234 3y agoI got you boss. Cheers to laziness
- galaxyLogic 3y agoLaziness is the Mother of Invention
- plopz 3y agoDoes it have HTTP/3 features like WebTransport?
- mmastrac 3y agoNot yet, but we are keeping our eyes on HTTP/3. There are a few good options for us to integrate it, but we want to make sure we do it right (and meanwhile figure out the right way to expose HTTP/2 features that aren't available yet).
- white_dragon88 3y agoSounds like sales speak, nodejs isn’t even there yet.
- steveklabnik 3y agoThere are like three different http/3 implementations in Rust, used in real ways. Even if they don't want to write their own, there's a lot of choice out there.
- mholt 3y agoThat's awesome, any automatic HTTPS (ideally by default)?
- mmastrac 3y agoYep. As long as you give Deno.serve a certificate and private key and you get modern TLS, HTTP1 and HTTP2.
- mholt 3y agoOh, sorry, to clarify, I meant: HTTPS that works automatically. By starting the server, it's starting HTTPS by default. It gets or generates a certificate for you and renews it, etc.
- mmastrac 3y agoIn this case, not in the built-in Deno.serve case. Certificate management is definitely a challenge, especially for local development.
- skybrian 3y agoDoes streaming work? Server-sent events?
- mmastrac 3y agoBoth of these definitely work. I'm on my phone right now so finding references is a challenge, but you can stream either of these ways (or use WebSockets) using Deno.serve.
- KRAKRISMOTT 3y agoEveryone's interested in SSE again thanks to serverless and Open AI's API
- kreetx 3y agoOpen AI's API is using SSE to stream results?
- KRAKRISMOTT 3y agoIt has a "streaming" mode (non-SSE, traditional long http requests") and many developers are choosing to forward chat data to end users with SSE (maybe to get around browser http request timeouts).