title: Websocket Push Notifications not working AFTER spring boot upgrade from 1.2.0 to 2.1.3
body: <p>This is about a spring <strong>boot</strong> + angularjs web application which uses <strong>websocket + stompjs</strong> to send push notifications.</p>
  
  <p>I upgraded from Spring boot <strong>1.2.0 to 2.1.3</strong> recently. <strong>Before</strong> this upgrade websocket (push notifications) was <strong>working fine for couple of years</strong>.</p>
  
  <p>I just upgraded spring boot and websocket related <strong>code remains exactly same</strong>, but it is <strong>not</strong> working now.</p>
  
  <p><strong>Not working means:</strong>  </p>
  
  <ol>
  <li>Below line executed at server side <strong>without</strong> any error/exception.</li>
  </ol>
  
  <p><code>simpMessagingTemplate.convertAndSend("/topic/notify", payload);</code></p>
  
  <ol start="2">
  <li>Chrome <strong>debugger</strong> receives only "h" (heartbeat) but not the actual message.</li>
  </ol>
  
  <p>I have <strong>no clue</strong> because,</p>
  
  <ul>
  <li>server side code executed successfully <strong>till the last line</strong>.</li>
  <li>websocket session established, I can get heartbeat messages, but no error at client side as well. </li>
  </ul>
  
  <p><strong>Code (but this same code works well with Spring boot 1.2.0:</strong></p>
  
  <p><strong>1. Config:</strong></p>
  
  <pre><code>@Configuration
  @EnableWebSocketMessageBroker
  public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {
  
      @Value("${server.sessionTimeout}")
      long sessionTimeoutInSecs;
  
      @Override
      public void configureMessageBroker(MessageBrokerRegistry config) {
          config.enableSimpleBroker("/topic");
          config.setApplicationDestinationPrefixes("/app");
      }
  
      @Override
      public void registerStompEndpoints(StompEndpointRegistry registry) {
          registry.addEndpoint("/notify").withSockJS();
      }
  
      @Bean
      public ServletServerContainerFactoryBean createWebSocketContainer() {
          ServletServerContainerFactoryBean container = new ServletServerContainerFactoryBean();
          // in milliseconds
          container.setMaxSessionIdleTimeout(sessionTimeoutInSecs * 1000);
          return container;
      }
  }
  </code></pre>
  
  <p><strong>2. Message sending code:</strong></p>
  
  <pre><code>simpMessagingTemplate.convertAndSend("/topic/notify", payload);
  </code></pre>
  
  <p><strong>3. Client code:</strong></p>
  
  <pre><code>(function() {
    myApp.factory('autoUpdateTasksService', function($resource, $q, $log) {
      var initSockets, notify, reconnect, socket, _callback;
      _callback = null;
      socket = {
        client: null,
        stomp: null
      };
      initSockets = function() {
        socket.client = new SockJS('/notify');
        socket.stomp = Stomp.over(socket.client);
        socket.stomp.connect({}, function() {});
        socket.client.onopen = function() {
          var subscription1;
          subscription1 = socket.stomp.subscribe("/topic/notify", notify);
          //$log.log('socket connected');
        };
      };
      reconnect = function() {
        setTimeout(initSockets, 1000);
      };
      notify = function(message) {
           try{
                var taskNotifyObject;
                    if (message.body) {
                      taskNotifyObject = angular.fromJson(message.body);
                      //$log.log(taskNotifyObject);
                      var notificationArray=[];
                      notificationArray.push(taskNotifyObject);
                      _callback(notificationArray);
                    } else {
                      //$log.log("empty message");
                    }
               } catch(e){
                  // alert(e.message); 
                   }
                  };
              return {
                init: function(callback) {
                  _callback = callback;
                  initSockets();
                }
              };
    });
  
  }).call(this);
  </code></pre>
  
  <p>Is anything changed in spring framework between versions?</p>
  
  <p>How I can debug/find <strong>where the message is lost?</strong></p>