public void send(String room,final Sys_msg sys_msg) {
log.info("start=> 消息发送");
// 通过each方法变量房间内的会话
websocket.each(room, new Each<Session>() {
@Override
public void invoke(int index, Session ele, int length) {
// 推送消息条数变更
websocket.sendJson(ele.getId(), new NutMap("type", "total")
.setv("data", new NutMap("total", sysMsgService
.countUnread(sys_msg == null ? TssoUtils.getCurrentUser().getUserId() : sys_msg.getUserId()))));
if (sys_msg != null) {
// 逐个会话发送消息
websocket.sendJson(ele.getId(), new NutMap("type", "msg").setv("data", sys_msg));
}
}
});
log.info("end=> 消息发送");
}
报错信息:The remote endpoint was in state [TEXT_FULL_WRITING] which is an invalid state for called method