本文使用nodered创建websocket连接,通过http网页websocket连接nodered展示数据,最后通过网页发送websocket消息给nodered
本文在以下作者内容上进行修改通过Node-Red在本地网页上实现PLC数据可视化(MySQL+HTML+JavaScript+CSS+WebSocket)_香风冰织的博客-优快云博客_plc可视化
目录
1. 在nodered配置websocket out给所有客户端发送websocket消息
2. 创建网页websocket连接nodered,展示数据
3. nodered配置websocket in接收发送的消息并显示
一 配置结果
在nodered配置如下:http://localhost:1880/
结果如下
(1)http://localhost:1880/hello
(2)使用http://www.jsons.cn/websocket/
连接nodered的websocket效果,自动获取到客户端消息如下
(3)使用网页客户端发送websocket消息
nodered显示如下