public void onMessage(final String message) throws Exception { service.onMessage(message); updateTimestamp(); }
public void onMessage(final String message) throws Exception { service.onMessage(message); updateTimestamp(); }
private void handleWebSocketFrame(final ChannelHandlerContext ctx, final WebSocketFrame wsFrame) throws Exception { if (wsFrame instanceof CloseWebSocketFrame) { wsFrame.retain(); service.onClose(); handshaker.close(ctx.channel(), (CloseWebSocketFrame) wsFrame); return; } if (wsFrame instanceof PingWebSocketFrame) { wsFrame.content().retain(); ctx.channel().writeAndFlush(new PongWebSocketFrame(wsFrame.content())); return; } if (!(wsFrame instanceof TextWebSocketFrame)) { throw new UnsupportedOperationException(String.format("%s frame types not supported", wsFrame.getClass().getName())); } final String message = ((TextWebSocketFrame) wsFrame).text(); service.onMessage(message); }
private void handleWebSocketFrame(final ChannelHandlerContext ctx, final WebSocketFrame wsFrame) throws Exception { if (wsFrame instanceof CloseWebSocketFrame) { wsFrame.retain(); service.onClose(); handshaker.close(ctx.channel(), (CloseWebSocketFrame) wsFrame); return; } if (wsFrame instanceof PingWebSocketFrame) { wsFrame.content().retain(); ctx.channel().writeAndFlush(new PongWebSocketFrame(wsFrame.content())); return; } if (!(wsFrame instanceof TextWebSocketFrame)) { throw new UnsupportedOperationException(String.format("%s frame types not supported", wsFrame.getClass().getName())); } final String message = ((TextWebSocketFrame) wsFrame).text(); service.onMessage(message); }