Search in sources :

Example 1 with PongMessage

use of org.springframework.web.socket.PongMessage in project spring-framework by spring-projects.

the class JettyWebSocketHandlerAdapter method onWebSocketFrame.

@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 (Exception ex) {
            ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, ex, logger);
        }
    }
}
Also used : PongMessage(org.springframework.web.socket.PongMessage) ByteBuffer(java.nio.ByteBuffer) OnWebSocketFrame(org.eclipse.jetty.websocket.api.annotations.OnWebSocketFrame)

Example 2 with PongMessage

use of org.springframework.web.socket.PongMessage in project spring-framework by spring-projects.

the class WebSocketStompClientTests method handleWebSocketMessagePong.

@Test
public void handleWebSocketMessagePong() throws Exception {
    connect().handleMessage(this.webSocketSession, new PongMessage());
    verifyNoMoreInteractions(this.stompSession);
}
Also used : PongMessage(org.springframework.web.socket.PongMessage) Test(org.junit.jupiter.api.Test)

Aggregations

PongMessage (org.springframework.web.socket.PongMessage)2 ByteBuffer (java.nio.ByteBuffer)1 OnWebSocketFrame (org.eclipse.jetty.websocket.api.annotations.OnWebSocketFrame)1 Test (org.junit.jupiter.api.Test)1