package com.example.cosmos_serversb; import com.example.cosmos_serversb.resources.WebSocket; import lombok.AllArgsConstructor; import org.springframework.context.annotation.Configuration; import org.springframework.web.socket.config.annotation.*; @Configuration @EnableWebSocket @AllArgsConstructor public class WebSocketConfig implements WebSocketConfigurer { private final WebSocket websocket = new WebSocket(); @Override public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { registry.addHandler(websocket, "/websocket"); } } //@Configuration //@EnableWebSocketMessageBroker //public class WebSocketConfig implements WebSocketConfigurer { // @Override // public void registerStompEndpoints(StompEndpointRegistry registry) { // registry.addEndpoint("/websocket") // .setAllowedOrigins("/websocket").withSockJS(); // } // @Override // public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { // registry.addHandler(websocket, "/endpoint"); // } // //}