Commit 69025ab3af5c0eb9bda7f2fe67e60a1314e8b211

Authored by YevhenBondarenko
1 parent e3851dca

TbWebSocketHandler refactoring

... ... @@ -63,6 +63,7 @@ public class TbWebSocketHandler extends TextWebSocketHandler implements Telemetr
63 63
64 64 private static final ConcurrentMap<String, SessionMetaData> internalSessionMap = new ConcurrentHashMap<>();
65 65 private static final ConcurrentMap<String, String> externalSessionMap = new ConcurrentHashMap<>();
  66 + private static final ByteBuffer PING_MSG = ByteBuffer.wrap(new byte[]{});
66 67
67 68 @Autowired
68 69 private TelemetryWebSocketService webSocketService;
... ... @@ -212,7 +213,7 @@ public class TbWebSocketHandler extends TextWebSocketHandler implements Telemetr
212 213 synchronized void sendPing(long currentTime) {
213 214 try {
214 215 if (currentTime - lastActivityTime >= pingTimeout) {
215   - this.asyncRemote.sendPing(ByteBuffer.wrap(new byte[]{}));
  216 + this.asyncRemote.sendPing(PING_MSG);
216 217 lastActivityTime = currentTime;
217 218 }
218 219 } catch (Exception e) {
... ...