DenoDDeno
Powered by
EsenteE
Denoβ€’3y ago
Esente

Reuse Deno.serve for other TCP connections

Hello,

As a newcommer to Deno, I wrote a client for NNTP protocol (https://github.com/sntran/deno_nntp) following the specs. In the process, I did all the reading the connection, parsing for status code and text, headers and body.

As I get more acquainted with Deno, I realize that I basically re-implemented what Deno HTTP API is, of course, in a much less efficient way.

I would like to ask for guideline in a way I can reuse some or most of that API to avoid the parsing.

For example, we have
Deno.serveHttp
Deno.serveHttp
. If I understand it correctly, it reads the connection for HTTP message (https://developer.mozilla.org/en-US/docs/Web/HTTP/Messages), parses into HTTP request and returns
HttpConn
HttpConn
, which yields up
RequestEvent
RequestEvent
. I would like to hook on that and return custom
Conn
Conn
instead. NNTP connection is very similar to HTTP conn.
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,944Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

Use deno serve for tcp
mpcrefMmpcref / help
10mo ago
Way too iterate over Deno.serve connections?
sachawSsachaw / help
2y ago
Piping two TCP connections to each other
TaxBusbyTTaxBusby / help
16mo ago
deno serve logs?
Jack MJJack M / help
2y ago