3

I'm just at the high-level of forming a concept here, so I'm really just looking for thoughts/ideas/suggestions about how this might be done -- if there's already something that does this, if I need to roll my own, or if maybe there's a couple separate projects that could be cobbled together to achieve this. Any and all input is appreciated :)

What I'd like to be able to do is have a "stream" (not sure what else to call it) broadcast? of data that will be served over an HTTP connection. This stream will serve events/updates/other data to clients that have subscribed to it (doesn't matter really what the data is, just that the client has subscribed in some fashion). This is nothing even remotely new, but what I'm having trouble tracking down is a way for multiple users/clients/connections to basically share the same stream/connection. In other words, I'm looking for a way for a web server to basically send data once and have all subscribed clients receive it. This way, for high-traffic applications, the web server doesn't have to send data explicitly to each and every listening connection.
I really hope that made sense.

  • Are there webservers/webserver-plugins that can already do this?
  • Would it be possible/feasible to adapt some form of video streaming library to achieve this?
  • Is this something I'll probably have to manage on my own (code that tracks subscribed connections, receives new data from some other service, and transparently replicates said data to each individual connection)?
  • Any other ideas, thoughts, concerns, caveats, etc?
4

1 回答 1

2

看看http://wiki.nginx.org/HttpPushStreamModule - 它似乎回答了您在跟踪订阅连接和将数据中继到每个客户端的现有功能方面的需求。将您的数据源设置为通道似乎需要一些时间,但除此之外它会处理其余部分。

我以前没有使用过那个模块,但是使用过 Nginx 本身——它非常好并且可以很好地处理并发连接。

于 2013-07-08T23:43:25.370 回答