Esente
Esente13mo ago

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. 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, which yields up RequestEvent. I would like to hook on that and return custom Conn instead. NNTP connection is very similar to HTTP conn.
0 Replies
No replies yetBe the first to reply to this messageJoin