org.springframework.messaging.simp.stomp.StompDecoder Java Examples

The following examples show how to use org.springframework.messaging.simp.stomp.StompDecoder. 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: WebSocketTransport.java    From WeEvent with Apache License 2.0 5 votes vote down vote up
@Override
public void onMessage(String message) {
    log.debug("received message");

    //decode from message
    StompDecoder decoder = new StompDecoder();
    List<Message<byte[]>> messages = decoder.decode(ByteBuffer.wrap(message.getBytes(StandardCharsets.UTF_8)));
    for (Message<byte[]> stompMsg : messages) {
        // handle the frame from the server
        handleFrame(stompMsg);
    }
}
 
Example #2
Source File: BrokerStomp.java    From WeEvent with Apache License 2.0 5 votes vote down vote up
@Override
protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception {
    if (!sessionContext.containsKey(session.getId())) {
        log.error("unknown session id, skip it");
        return;
    }

    List<Message<byte[]>> stompMsg = new StompDecoder().decode(ByteBuffer.wrap(message.getPayload().getBytes(StandardCharsets.UTF_8)));
    for (Message<byte[]> msg : stompMsg) {
        this.handleSingleMessage(msg, session);
    }
}
 
Example #3
Source File: StompSubProtocolHandler.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Configure a {@link StompDecoder} for decoding STOMP frames.
 * @since 4.3.5
 */
public void setDecoder(StompDecoder decoder) {
	this.stompDecoder = decoder;
}
 
Example #4
Source File: StompSubProtocolHandler.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Configure a {@link StompDecoder} for decoding STOMP frames.
 * @since 4.3.5
 */
public void setDecoder(StompDecoder decoder) {
	this.stompDecoder = decoder;
}