Spring websockets: message not published
<p>I use Spring WebSockets with STOMP and SockJS for frontend. It works FINE but I have another difficulty.</p>

<p>This is backend code:</p>

<pre><code> @MessageMapping("/showAccountlist")
 @SendTo("/topic/accounts")
 public Account createPublishAccount(String name) throws Exception {

     return new Account(name);
 }
</code></pre>

<p>And this is front end code, which works FINE, all messages gets published to all clients.</p>

<pre><code> stompClient.send("/app/showAccountlist", {}, name);
</code></pre>

<p>BUT when I call my backend method <strong>from</strong> my java backend, with method name </p>

<pre><code>createPublishAccount("Carlos");
</code></pre>

<p>Seems like messages does not get published. Any solution? Or this is not how it meant to work and it only works when it is triggered via SockJS?</p>

<p>This is my webconfig:</p>

<pre><code>@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer  {

@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
    config.enableSimpleBroker("/topic");
    config.setApplicationDestinationPrefixes("/app");
}

@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
    registry.addEndpoint("/showAccountlist").withSockJS();
}
</code></pre>

<p>}</p>