douba6361 2016-03-24 01:14
浏览 78
已采纳

是否有用于节点(或其他语言)的基于网络的应用程序的“中间件”库? [关闭]

I am looking to write a couple of tcp servers/clients in node. I'm trying to figure out what node.js ecosystem provides for making such development easier. I'm thinking of something similar to parts of (java's) netty. That project provides a way to implement the protocol in a way that it can be plugged into the network code pipeline or taken out of actual tcp connection code to be tested independently.

Node's http frameworks often provide a middle-ware layer. Users can write code which intercepts requests or responses to isolate bits of functionality so the actual request/response interface doesn't change much. This results in 3rd party providers of such code which does logging, authentication, etc.

Does something like this exist for lower level networking code? (since my testing out some ideas, if someone knows of other non-java/c++/c# languages which DO provide such features/libraries, I'd like to read about them as well)

  • 写回答

2条回答 默认 最新

  • douyoufan7881 2016-03-24 01:57
    关注

    Since you tagged Elixir, I'll bite.

    While Elixir has a great framework for building something like this for HTTP clients (Plug), an option I'd consider is using the vegur and ranch_proxy_protocol libraries (written in Erlang by Heroku, but easily used in Elixir), vegur offers a pluggable middleware layer which are easily tested in isolation. I'm currently using this for a proxy layer at my company.

    Even without those, building an application like this using ranch would be very trivial. Ranch handles listening/accepting/reading/writing from sockets, and you could just insert a pluggable pipeline where needed, enforced using a behaviour (the Erlang/Elixir equivalent of an interface).

    These types of applications are pretty much a sweet spot for Erlang and Elixir, I'd highly recommend it if you are familiar or interested in either one.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 spring后端vue前端
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题