docs: update wg-basic/websocket

This commit is contained in:
Administrator 2021-10-09 08:47:06 +00:00 committed by John Smith
parent a6806dcccd
commit 1651810072

View File

@ -2,7 +2,7 @@
title: 7.即时消息
description: 即时消息模块的使用
published: true
date: 2021-10-09T08:45:08.414Z
date: 2021-10-09T08:47:05.055Z
tags: wg-basic
editor: markdown
dateCreated: 2021-09-14T06:25:26.887Z
@ -117,7 +117,7 @@ websocket:
2. 在 **handle** 方法中完成业务逻辑handle方法接收两个参数第一个参数时当前会话通道第二个参数时消息体
3. 发送消息调用WebSocketChannelManager.getInstance().sendText(channel, message) 方法发送消息
# WebSocketChannelManager
# 通道管理器(WebSocketChannelManager
该类不能 **new**,通过 **getInstance()** 方法得到单例对象,提供了如下功能:
@ -131,3 +131,7 @@ websocket:
| getOnlineUserByChannelId | channelId: 通道ID | 通过通道获取用户 |
| sendText | channel: 接收人通道, webSocketClientMessage: 发送内容 | 单发文本消息 |
| sendGroupText | channels: 接收人通道列表, webSocketClientMessage: 发送内容 | 群发文本消息 |
# 消息体WebSocketClientMessage