| | |
| | | |
| | | import javax.websocket.Session; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.yc.action.grid.GridUtils; |
| | | import com.yc.im.action.WebSocketIMServer; |
| | | |
| | |
| | | message.setDbId(this.getDbId()); |
| | | info.setInfo(message); |
| | | try { |
| | | this.session.getBasicRemote().sendText(GridUtils.toJsonNotNull(info));//用异步发送 |
| | | this.session.getBasicRemote().sendText(JSON.toJSONString(info));//用异步发送 |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | WebSocketIMServer.printError(e,this.session); |
| | | } |
| | | } |
| | | } |
| | | public void sendMessageV2(Object message){ |
| | | |
| | | if (!this.session.isOpen()){ |
| | | return; |
| | | } |
| | | synchronized (this.session) { |
| | | CallBackMessage info = new CallBackMessage(); |
| | | info.setInfo(message); |
| | | try { |
| | | this.session.getBasicRemote().sendText(JSON.toJSONString(info));//用异步发送 |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | WebSocketIMServer.printError(e,this.session); |