Исправлена ошибка WebSocket

This commit is contained in:
serega6531
2019-05-10 03:03:25 +03:00
parent d1a69db830
commit 1f2869f939
2 changed files with 5 additions and 1 deletions

View File

@@ -56,6 +56,8 @@ public class ApplicationConfiguration extends WebSecurityConfigurerAdapter imple
@Override @Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
registry.addHandler(webSocketHandler, "/api/ws").withSockJS(); registry.addHandler(webSocketHandler, "/api/ws")
.setAllowedOrigins("*")
.withSockJS();
} }
} }

View File

@@ -7,9 +7,11 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.event.EventListener; import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
@SpringBootApplication @SpringBootApplication
@EnableScheduling @EnableScheduling
@EnableWebSocket
public class PackmateApplication { public class PackmateApplication {
@Value("${enable-capture}") @Value("${enable-capture}")