Nginx HTTP PUSH 上的会话/授权 comet
Nginx 的 HTTP PUSH 方法相对简单。涉及 3 方:订阅者(接收者)、发布者(发送者),服务器本身充当组播服务器。
Nginx还可以分成不同的频道,具有不同的频道ID供用户访问。
但我仍然不知道如何仅对登录用户授权/限制内容,或仅向该用户发送所需的数据,而不是将其多播给任何知道频道 ID 的人。
如果可能的话,是否有办法只使用一个通道并有选择地向用户发送数据?
目前我在同一个数据库上运行,但发送器是用 ruby 编写的,使用 nginx,前端是使用 PHP/GWT 编写的。
非常感谢
The Nginx approach to HTTP PUSH is relatively simple. There are 3 party involve: Subcriber (receiver), Publisher (sender), and the server itself act as multicast server.
Nginx can also separate into different channel with different channel ID that user can access.
But I still don't know how to authorize/limit content only for logged in user, or send only the data needed to that user, instead of multicast it to anyone know about the channel ID.
If possible, are there anyway to use only a channel and send data to user selectively?
Currently i am running on the same database, but the Sender is writen in ruby, using nginx, and the front end is writen using PHP/GWT.
Thank you very much
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许您可以使用我的 http_push_module 模块的分支,它实现了对通道的细粒度安全访问。它提供通道的过期时间和每个客户端 IP/每个通道的安全性(如果需要的话,它还会添加 jsonp 支持,作为一个优点):
https://github.com/Kronuz/nginx_http_push_module
使用该模块,您可以为登录的用户提供一个有效的密钥以供使用(甚至可以过期,或者仅使用 FFFFFFFF 作为过期时间)日期,以便它永不过期),并根据您的需要对他们的访问进行限制,甚至可以使用嵌入在密钥中的 IP 地址来“打开”通道。我希望这有帮助。
Maybe you can use my fork of the http_push_module module, it implements fine grain security access to channels. It provides expiration times to channels and per-client-IP/per-channel security (it additionally adds jsonp support if you need it, as a plus):
https://github.com/Kronuz/nginx_http_push_module
Using the module you can give your logged in users a valid key to use (which can even expire, or just use FFFFFFFF otherwise as the expiration date so it never expires) and be as restrictive as you want with their access, even by using their IP address embedded in the key to "open" the channel. I hope this helps.
这是我的设置:
>
This is my setup:
>