nodejs 使用ws模块包实现指定用户 发送消息
nodejs 使用ws模块包实现指定用户 发送消息思路前端连接(websoket) 发送自身的唯一id连接上后在 ws客户端中存下标识id添加进clients 数组再通过服务器端请求后端接口 如GET ,POST在请求中 遍历每个客户端应用 如果复合条件 则client.send返回 回去前端方法(H5,微信小程序)微信小程序第一步 连接后端websoket wx.connectSocket({ //url 是连接后端websocket的地址 //http 就用ws
原创
2021-01-25 15:20:31 ·
5508 阅读 ·
4 评论