Deprecated as of 5.0 a TaskScheduler is not provided upfront, not until it is obvious that it is needed; call SockJsServiceRegistration.getTaskScheduler() to check and then SockJsServiceRegistration.setTaskScheduler(TaskScheduler) to set it before a call to SockJsServiceRegistration.createSockJsService()
sockJsServiceRegistration.setSessionCookieNeeded(this.sockJsServiceOptions.sessionCookieNeeded);
@Override public void registerStompEndpoints(StompEndpointRegistry registry) { registry.addEndpoint("/rest/alienEndPoint").withSockJS().setSessionCookieNeeded(true); registry.addEndpoint("/rest/v1/alienEndPoint").withSockJS().setSessionCookieNeeded(true); registry.addEndpoint("/rest/latest/alienEndPoint").withSockJS().setSessionCookieNeeded(true); } }
@Override public void registerStompEndpoints(StompEndpointRegistry registry) { registry.addEndpoint("/stomp") .setAllowedOrigins("*") .withSockJS() //.setWebSocketEnabled(false) .setSessionCookieNeeded(false); }
private void publishWebSocketEndpoint(WebSocketHandlerRegistry wsHandlerRegistry, JsonRpcHandler<?> handler, List<String> paths) { ProtocolManager protocolManager = (ProtocolManager) ctx.getBean("protocolManager", handler); JsonRpcWebSocketHandler wsHandler = new JsonRpcWebSocketHandler(protocolManager); protocolManager.setPingWachdog(handler.isPingWatchdog()); for (String path : paths) { WebSocketHandlerRegistration registration = wsHandlerRegistry.addHandler(wsHandler, path); List<String> origins = handler.allowedOrigins(); registration.setAllowedOrigins(origins.toArray(new String[origins.size()])); if (handler.isSockJSEnabled()) { registration.withSockJS().setSessionCookieNeeded(false); } if (handler.getLabel() != null) { wsHandler.setLabel(handler.getLabel()); } } }
private void publishWebSocketEndpoint(WebSocketHandlerRegistry wsHandlerRegistry, JsonRpcHandler<?> handler, List<String> paths) { ProtocolManager protocolManager = (ProtocolManager) ctx.getBean("protocolManager", handler); JsonRpcWebSocketHandler wsHandler = new JsonRpcWebSocketHandler(protocolManager); protocolManager.setPingWachdog(handler.isPingWatchdog()); for (String path : paths) { WebSocketHandlerRegistration registration = wsHandlerRegistry.addHandler(wsHandler, path); List<String> origins = handler.allowedOrigins(); registration.setAllowedOrigins(origins.toArray(new String[origins.size()])); if (handler.isSockJSEnabled()) { registration.withSockJS().setSessionCookieNeeded(false); } if (handler.getLabel() != null) { wsHandler.setLabel(handler.getLabel()); } } }
sockJsServiceRegistration.setSessionCookieNeeded(this.sockJsServiceOptions.sessionCookieNeeded);