|
|
|
|
@ -11,7 +11,6 @@ import io.netty.util.CharsetUtil; |
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
|
|
|
|
|
import javax.xml.soap.Text; |
|
|
|
|
import java.util.Timer; |
|
|
|
|
import java.util.TimerTask; |
|
|
|
|
|
|
|
|
|
@ -77,11 +76,12 @@ public class WebsocketClientHandler extends SimpleChannelInboundHandler<Object> |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
sendMsgTimer = new Timer(); |
|
|
|
|
log.info(">>>> start send msg to 808."); |
|
|
|
|
sendMsgTimer.schedule(new TimerTask() { |
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
|
String clientId = PublishManager.getInstance().getCurPushDevice(); |
|
|
|
|
log.info("send msg to 808. clientId : " + clientId); |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
WebsocketClient.getWsInstance().write(clientId); |
|
|
|
|
} catch (MyException e) { |
|
|
|
|
@ -117,7 +117,6 @@ public class WebsocketClientHandler extends SimpleChannelInboundHandler<Object> |
|
|
|
|
try { |
|
|
|
|
WebsocketClient wsClient = WebsocketClient.getWsInstance(); |
|
|
|
|
wsClient.connect(); |
|
|
|
|
log.info("reconnect success!"); |
|
|
|
|
} catch (MyException e) { |
|
|
|
|
log.info("reconnect failed! msg : " + e.getMessage()); |
|
|
|
|
} |
|
|
|
|
@ -143,7 +142,6 @@ public class WebsocketClientHandler extends SimpleChannelInboundHandler<Object> |
|
|
|
|
throw new IllegalStateException("Unexpected FullHttpResponse (getStatus=" + response.status() + ", content=" + response.content().toString(CharsetUtil.UTF_8) + ')'); |
|
|
|
|
} else if (msg instanceof TextWebSocketFrame) { |
|
|
|
|
TextWebSocketFrame response = (TextWebSocketFrame) msg; |
|
|
|
|
log.info("receive msg : " + response.text()); |
|
|
|
|
} |
|
|
|
|
this.handleWebSocketFrame(msg); |
|
|
|
|
} |
|
|
|
|
|