| | |
| | | package com.yami.trading.api.websocket; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.json.JSONArray; |
| | | import org.json.JSONObject; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.websocket.*; |
| | |
| | | if (WebSocketEnum.SOCKET_ENUM_REALTIME.getCode().equals(type)) { |
| | | if (realtimeMap.get(key) != null) { |
| | | realtimeMap.get(key).sendMessage(message); |
| | | // JSONObject jsonObject = new JSONObject((message)); |
| | | // JSONArray dataArray = jsonObject.getJSONArray("data"); |
| | | // for (int i = 0; i < dataArray.length(); i++) { |
| | | // JSONObject item = dataArray.getJSONObject(i); |
| | | // if(item.get("name").equals("GBPUSD")){ |
| | | // System.out.println("realtimeMap中取到的价格:"+item.get("close")); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | } else { |
| | | System.out.println("realtimeMap中没有此key,不推送消息"); |
| | | } |