0

My problem is I don't know how i set StompSubProtocolHandler at XML

I try and know normal websocket set

<websocket:handlers allowed-origins="*">
         <websocket:mapping path="/raphaServerHandler.do" handler="raphaServerHandler"/>
   </websocket:handlers>

But I need to know setting StompSubProtocolHandler at XML!

David Jeong
  • 109
  • 1
  • 8

1 Answers1

0

It is done automatically by the:

<websocket:message-broker application-destination-prefix="/app">
    <websocket:stomp-endpoint path="/foo" />
    <websocket:simple-broker prefix="/topic" />
</websocket:message-broker>

<xsd:documentation><![CDATA[
Configures broker-backed messaging over WebSocket using a higher-level messaging sub-protocol.
Registers a SimpleUrlHandlerMapping and maps paths to registered Controllers.

A StompSubProtocolHandler is registered to handle various versions of the STOMP protocol.

See EnableWebSocketMessageBroker javadoc for information on code-based alternatives to enabling broker-backed messaging.
        ]]></xsd:documentation>

http://docs.spring.io/spring/docs/current/spring-framework-reference/html/websocket.html#websocket-stomp-enable

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118
  • I know setting Socket Stomp but Your sample code need contoller and MessageMapping but StompSubProtocol dont have MessageMapping – David Jeong Mar 09 '17 at 22:56
  • Not sure how `@MessageMapping` is related to your question. The `StompSubProtocolHandler` is populated in the `MessageBrokerBeanDefinitionParser`. The `@MessageMapping` is done automatically then. – Artem Bilan Mar 10 '17 at 13:43
  • Ah... Sorry. and Thank you. In fact I don't know channel and in-out bound concept of websocket.. Do you have any sample code.. ? about stompSubProtocol? – David Jeong Mar 10 '17 at 15:25
  • Try investigate this application: https://github.com/rstoyanchev/spring-websocket-portfolio – Artem Bilan Mar 10 '17 at 16:03
  • Hi @ArtemBilan Could you please take a look at my similar question: https://stackoverflow.com/questions/55519260/error-handling-while-using-stomp-simple-broker – ctomek Apr 04 '19 at 15:22