File was renamed from src/main/java/com/whyc/webSocket/DevLineSocket.java |
| | |
| | | import com.whyc.config.WebSocketConfig; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.db_user.UserInf; |
| | | import com.whyc.service.DevInfService; |
| | | import com.whyc.service.DevLithiumInfService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | * 左侧列表 |
| | | */ |
| | | @Component |
| | | @ServerEndpoint(value = "/lineSocket",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) |
| | | public class DevLineSocket{ |
| | | @ServerEndpoint(value = "/devLithiumLine",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) |
| | | public class DevLithiumLineSocket { |
| | | |
| | | private Session session; |
| | | |
| | | private Thread thread; |
| | | private static DevInfService dinfService; |
| | | private static DevLithiumInfService service; |
| | | |
| | | private HttpSession httpSession; |
| | | |
| | | @Autowired |
| | | public void setDevInfService(DevInfService dinfService) { |
| | | DevLineSocket.dinfService = dinfService; |
| | | public void setService(DevLithiumInfService service) { |
| | | DevLithiumLineSocket.service = service; |
| | | } |
| | | |
| | | @OnOpen |
| | |
| | | public void run() { |
| | | try { |
| | | while (!currentThread().isInterrupted()) { |
| | | Response res = dinfService.getDevType(userId); |
| | | Response res = service.getDevType(userId); |
| | | session.getBasicRemote().sendObject(res); |
| | | sleep(4000); |
| | | } |