org.eclipse.jetty.websocket.api.extensions.Frame Java Examples
The following examples show how to use
org.eclipse.jetty.websocket.api.extensions.Frame.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JettyWebSocketHandlerAdapter.java From spring-analysis-note with MIT License | 5 votes |
@OnWebSocketFrame public void onWebSocketFrame(Frame frame) { if (this.delegateSession != null) { if (OpCode.PONG == frame.getOpCode()) { ByteBuffer buffer = (frame.getPayload() != null ? frame.getPayload() : EMPTY_PAYLOAD); WebSocketMessage webSocketMessage = toMessage(Type.PONG, buffer); this.delegateSession.handleMessage(webSocketMessage.getType(), webSocketMessage); } } }
Example #2
Source File: JettyWebSocketHandlerAdapter.java From spring-analysis-note with MIT License | 5 votes |
@OnWebSocketFrame public void onWebSocketFrame(Frame frame) { if (OpCode.PONG == frame.getOpCode()) { ByteBuffer payload = frame.getPayload() != null ? frame.getPayload() : EMPTY_PAYLOAD; PongMessage message = new PongMessage(payload); try { this.webSocketHandler.handleMessage(this.wsSession, message); } catch (Throwable ex) { ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, ex, logger); } } }
Example #3
Source File: JettyWebSocketHandlerAdapter.java From java-technology-stack with MIT License | 5 votes |
@OnWebSocketFrame public void onWebSocketFrame(Frame frame) { if (this.delegateSession != null) { if (OpCode.PONG == frame.getOpCode()) { ByteBuffer buffer = (frame.getPayload() != null ? frame.getPayload() : EMPTY_PAYLOAD); WebSocketMessage webSocketMessage = toMessage(Type.PONG, buffer); this.delegateSession.handleMessage(webSocketMessage.getType(), webSocketMessage); } } }
Example #4
Source File: JettyWebSocketHandlerAdapter.java From java-technology-stack with MIT License | 5 votes |
@OnWebSocketFrame public void onWebSocketFrame(Frame frame) { if (OpCode.PONG == frame.getOpCode()) { ByteBuffer payload = frame.getPayload() != null ? frame.getPayload() : EMPTY_PAYLOAD; PongMessage message = new PongMessage(payload); try { this.webSocketHandler.handleMessage(this.wsSession, message); } catch (Throwable ex) { ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, ex, logger); } } }
Example #5
Source File: LoggregatorSocket.java From orion.server with Eclipse Public License 1.0 | 5 votes |
@OnWebSocketFrame public void onFrame(Frame frame) { try { if (frame == null || frame.getPayload() == null) return; LoggregatorMessage.Message message = LoggregatorMessage.Message.parseFrom(frame.getPayload().array()); listener.add(message); } catch (InvalidProtocolBufferException e) { logger.error("Error while receiving socket frame", e); } catch (Throwable t) { logger.error("Error while receiving socket frame", t); } }
Example #6
Source File: JettyWebSocketHandlerAdapter.java From spring4-understanding with Apache License 2.0 | 5 votes |
@OnWebSocketFrame public void onWebSocketFrame(Frame frame) { if (OpCode.PONG == frame.getOpCode()) { ByteBuffer payload = frame.getPayload() != null ? frame.getPayload() : EMPTY_PAYLOAD; PongMessage message = new PongMessage(payload); try { this.webSocketHandler.handleMessage(this.wsSession, message); } catch (Throwable ex) { ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, ex, logger); } } }
Example #7
Source File: ServiceSocket.java From JMeter-WebSocketSampler with Apache License 2.0 | 5 votes |
@OnWebSocketFrame public void onFrame(Frame frame) { synchronized (parent) { log.debug("Received frame: " + frame.getPayload() + " " + frame.getType().name()); String length = " (" + frame.getPayloadLength() + " bytes)"; logMessage.append(" - Received frame #").append(messageCounter) .append(length); String frameTxt = new String(frame.getPayload().array()); addResponseMessage("[Frame " + (messageCounter++) + "]\n" + frameTxt + "\n\n"); if (responseExpression == null || responseExpression.matcher(frameTxt).find()) { logMessage.append("; matched response pattern").append("\n"); closeLatch.countDown(); } else if (!disconnectPattern.isEmpty() && disconnectExpression.matcher(frameTxt).find()) { logMessage.append("; matched connection close pattern").append( "\n"); closeLatch.countDown(); close(StatusCode.NORMAL, "JMeter closed session."); } else { logMessage.append("; didn't match any pattern").append("\n"); } } }
Example #8
Source File: BoseSoundTouchHandler.java From smarthome with Eclipse Public License 2.0 | 4 votes |
@Override public void onWebSocketFrame(Frame frame) { if (frame.getType() == Type.PONG) { missedPongsCount = 0; } }
Example #9
Source File: ConsoleProxyNoVNCHandler.java From cloudstack with Apache License 2.0 | 4 votes |
@OnWebSocketFrame public void onFrame(Frame f) throws IOException { viewer.sendClientFrame(f); }
Example #10
Source File: ConsoleProxyNoVncClient.java From cloudstack with Apache License 2.0 | 4 votes |
public void sendClientFrame(Frame f) throws IOException { byte[] data = new byte[f.getPayloadLength()]; f.getPayload().get(data); client.write(data); }