@Override public void onWebSocketBinary(byte[] payload, int offset, int len) { if (isNotConnected()) { return; } try { LOGGER.debug("Received binary frame of size {}: {}", len, new String(payload, offset, len, UTF_8)); getRemote().sendBytes(ByteBuffer.wrap(payload, offset, len)); } catch (IOException e) { e.printStackTrace(); } }
@Override public void onWebSocketText(String message) { if (isNotConnected()) { return; } if (message.equals("CLOSE")) { getSession().close(); return; } try { LOGGER.debug("Received text frame of size: {}", message); getRemote().sendString(message); } catch (IOException e) { e.printStackTrace(); } } }