client = new WebSocketClient(new URI("ws://192.168.4.100:8080/project/websocket"),new Draft_6455()) { @Override public void onOpen(ServerHandshake serverHandshake) { logger.info("握手成功"); }
@Override
public void onMessage(String msg) {
logger.info("收到消息=========="+msg);
if(msg.equals("over")){
client.close();
}
}
@Override
public void onClose(int i, String s, boolean b) {
logger.info("链接已关闭");
}
@Override
public void onError(Exception e){
e.printStackTrace();
logger.info("发生错误已关闭");
}
};
我想在这个 onMessage 中去做查数据库的操作,但是似乎方法不会被调用,有解决办法吗