uniapp和web.html互相通讯

This commit is contained in:
2023-09-25 22:10:02 +08:00
parent 161631f6a0
commit a4dda571ab
5 changed files with 15 additions and 4 deletions

View File

@@ -410,7 +410,7 @@
//如果浏览器支持WebSocket
if (window.WebSocket) {
//参数就是与服务器连接的地址
socket = new WebSocket("ws://localhost:19000/ws");
socket = new WebSocket("ws://192.168.1.117:19000/ws");
//客户端收到服务器消息的时候就会执行这个回调方法
socket.onmessage = function (event) {