| | |
| | | package com.moral.config; |
| | | |
| | | import com.moral.service.DeviceService; |
| | | import com.moral.service.SensorService; |
| | | import com.moral.webSocketServer.BSAQIWebSocketServer; |
| | | import com.moral.webSocketServer.BSWebsocketServer; |
| | | import com.moral.webSocketServer.WebSocketServer; |
| | | |
| | | import com.moral.webSocketServer.WebSocketServerNew; |
| | | import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; |
| | | import org.springframework.amqp.support.converter.MessageConverter; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.web.socket.server.standard.ServerEndpointExporter; |
| | | |
| | | @Configuration |
| | | public class WebSocketConfig { |
| | | |
| | | /* @Bean |
| | | //本地测试需要将注释解开 |
| | | /*@Bean |
| | | public ServerEndpointExporter serverEndpointExporter() { |
| | | return new ServerEndpointExporter(); |
| | | }*/ |
| | |
| | | return new Jackson2JsonMessageConverter(); |
| | | } |
| | | |
| | | @Autowired |
| | | public void setMessageService(DeviceService deviceService){ |
| | | WebSocketServer.deviceService=deviceService; |
| | | WebSocketServerNew.deviceService=deviceService; |
| | | BSWebsocketServer.deviceService=deviceService; |
| | | BSAQIWebSocketServer.deviceService=deviceService; |
| | | } |
| | | @Autowired |
| | | public void setSensorService( SensorService sensorService){ |
| | | BSWebsocketServer.sensorService=sensorService; |
| | | BSAQIWebSocketServer.sensorService=sensorService; |
| | | } |
| | | |
| | | } |