简体   繁体   English

使用 html/javascript 发送 redis 消息

[英]Send redis message with html/javascript

I'm trying to find a way to send a redis message to a specific channel from a website.我正在尝试找到一种将 redis 消息从网站发送到特定频道的方法。 I think this might work, but I don't know how to use it and there is very little explanation.我认为可能有效,但我不知道如何使用它,而且解释很少。

Redis is supposed to only connect with a server, not directly with a client such as a browser (it's actually impossible to directly connect to redis from a browser). Redis 应该只与服务器连接,而不是直接与浏览器等客户端连接(实际上不可能从浏览器直接连接到 redis)。

You can achieve that running webdis on the server with redis and connecting to it from the browser, resulting in an infrastructure similar to this:您可以使用 redis 在服务器上运行 webdis 并从浏览器连接到它,从而产生类似于以下的基础架构:

Client       Server
----------------------
         |
         |
Browser ---> webdis
         |     |
         |     |
         |     v
         |   redis

Note that it would not be secure, because the client on the browser could do whatever he wants with your redis database.请注意,这并不安全,因为浏览器上的客户端可以对您的 redis 数据库做任何他想做的事情。

Usually, a custom server program is implemented that forward your commands to the redis server in a controlled way:通常,会实现一个自定义服务器程序,以受控方式将您的命令转发到 redis 服务器:

Client       Server
----------------------
         |
         |
Browser ---> custom server
         |        |
         |        |
         |        v
         |      redis

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

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