在Web浏览器中实现一个好的redis-client需要什么? [英] What would it take to implement a good redis-client in the web-browser?
问题描述
以前曾在
我可以从浏览器中运行的JavaScript直接连接到Redis服务器吗?
(注意我的评论)
和
使用(客户端)javascript直接连接到Redis?
但我想知道哪些东西会有完美的实时连接。阅读(a node-redis客户端) https://github.com/luin/ioredis 来源I注意到节点库的 net
部分可能包含我们需要在浏览器中重现的功能。
This has been asked before at
Can I connect directly to a Redis server from JavaScript running in a browser?
(notice my comment)
and
Connecting directly to Redis with (client side) 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 .
猜猜也许某些网络功能可能会被黑客攻击?
Guessing maybe something with hacked together from pieces of webrtc functions could do it ?
预期收益与建筑有关大型分布式应用系统基础设施 - 如社交媒体(来自上面链接的第一个问题的评论):
Prospective benefits relate to building large distributed app systems infrastructure -- like social media (from comment on first question linked above):
我再次问这个问题,但是规定我们想要在浏览器中运行的实时redis-client中的真实 - 而不是HTTP任何东西。可以构建一个伟大的实时基础设施,只需要CDN服务资产构成客户端webapp直接与Redis通信。我想删除系统中不必要的WebSocket服务器方面。所有控制逻辑都可以内化到Lua中的redis集群。
I'm asking this question again, but stipulating we want a 'real' as in realtime redis-client -- not HTTP anything -- operating in the browser. Could build a great realtime 'infrastructure' with just CDN serving assets constituting the client webapp communicating with Redis directly. I want to cut out the unnecessary WebSocket server aspect of the system. All the control logic can be internalised to redis cluster in Lua.
推荐答案
要在Web浏览器中实现直接redis-client,您需要更改Redis本身,所以它将暴露WebSocket接口。这样你就可以使用最简单的协议浏览器。
To implement a direct redis-client in the web-browser you need to change Redis itself, so it will expose WebSocket interface. That way you will get the simplest protocol browser is allowed to use.
其他方法将涉及中间层。我认为应该可以通过 ws-tcp-relay 来代理命令快。
Other approaches will involve intermediate layers. I think it should be possible to proxy commands via ws-tcp-relay which is pretty fast.
这篇关于在Web浏览器中实现一个好的redis-client需要什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!