| | |
| | | @Slf4j |
| | | public class WebsocketRunClient extends WebSocketClient { |
| | | |
| | | public WebsocketRunClient(URI serverUri) { |
| | | private EStockType eStockType; |
| | | public WebsocketRunClient(URI serverUri, |
| | | EStockType eStockType |
| | | ) { |
| | | super(serverUri); |
| | | this.eStockType = eStockType; |
| | | } |
| | | |
| | | @Override |
| | | public void onOpen(ServerHandshake serverHandshake) { |
| | | send(("key:"+ EStockType.IN.getStockKey()+":"+EStockType.IN.getContryId()).getBytes()); |
| | | send(("key:"+ eStockType.getStockKey()+":"+eStockType.getContryId()).getBytes()); |
| | | } |
| | | |
| | | @Override |
| | | public void onMessage(String s) { |
| | | try { |
| | | |
| | | |
| | | ApplicationContext act = ApplicationContextRegisterUtil.getApplicationContext(); |
| | | MandatoryLiquidationService liquidationService = (MandatoryLiquidationService) act.getBean(IMandatoryLiquidationService.class); |
| | | StockRealTimeBean stockDetailBean = new Gson().fromJson(s, StockRealTimeBean.class); |
| | | liquidationService.RealTimeDataProcess(EStockType.IN,stockDetailBean); |
| | | liquidationService.RealTimeDataProcess(eStockType,stockDetailBean); |
| | | }catch (Exception e){ |
| | | |
| | | } |
| | |
| | | |
| | | @Override |
| | | public void onClose(int i, String s, boolean b) { |
| | | log.info("websocket 关闭"+1); |
| | | log.info("websocket 马来西亚 关闭"+1); |
| | | } |
| | | |
| | | @Override |