简体   繁体   English

在Web浏览器中实现一个好的redis-client需要什么?

[英]What would it take to implement a good redis-client in the web-browser?

This has been asked before at Can I connect directly to a Redis server from JavaScript running in a browser? 之前已经问过我可以从浏览器中运行的JavaScript直接连接到Redis服务器吗? (notice my comment) and Connecting directly to Redis with (client side) javascript? (注意我的评论)和直接连接到Redis与(客户端)javascript? but I wonder about something which would have perfect realtime connection. 但我想知道哪些东西会有完美的实时连接。 Reading the (a node-redis client) https://github.com/luin/ioredis source I noticed the net part of node`s library is likely containing the kind of functionality we'd need to reproduce in the browser to do this . 阅读(node-redis客户端) https://github.com/luin/ioredis源我注意到node`s库的net部分可能包含我们需要在浏览器中重现的功能才能执行此操作。

Guessing maybe something with hacked together from pieces of webrtc functions could do it ? 猜猜也许是从webrtc函数中一起被黑客攻击的东西可以做到的吗?

Prospective benefits relate to building large distributed app systems infrastructure -- like social media (from comment on first question linked above): 预期收益涉及构建大型分布式应用系统基础设施 - 如社交媒体(来自上面链接的第一个问题的评论):

I'm asking this question again, but stipulating we want a 'real' as in realtime redis-client -- not HTTP anything -- operating in the browser. 我再次问这个问题,但是规定我们想要在浏览器中运行的实时redis-client中的“真实” - 而不是HTTP任何东西。 Could build a great realtime 'infrastructure' with just CDN serving assets constituting the client webapp communicating with Redis directly. 可以构建一个伟大的实时“基础设施”,只需要CDN服务资产构成客户端webapp直接与Redis通信。 I want to cut out the unnecessary WebSocket server aspect of the system. 我想删除系统中不必要的WebSocket服务器方面。 All the control logic can be internalised to redis cluster in Lua. 所有控制逻辑都可以内化到Lua中的redis集群。

To implement a direct redis-client in the web-browser you need to change Redis itself, so it will expose WebSocket interface. 要在Web浏览器中实现直接redis-client,您需要更改Redis本身,因此它将公开WebSocket接口。 That way you will get the simplest protocol browser is allowed to use. 这样您就可以使用最简单的协议浏览器。

Other approaches will involve intermediate layers. 其他方法将涉及中间层。 I think it should be possible to proxy commands via ws-tcp-relay which is pretty fast. 我认为应该可以通过ws-tcp-relay代理命令,这非常快。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM