Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

181
Vistas
React WebSocket Fails Without Error for Spring Boot

I validated that my websocket works by using Postman, however when I try and use the Javascript WebSocket class to connect from the frontend, I get a WebSocket connection to 'ws://...' failed that does not provide any error or description. I understand that for security reasons the browser does not display a comprehensive error message, however I am unsure what is going on and how to fix it.

Frontend:

ReactDOM.render(<Testing />, document.getElementById('root))

const Testing = () => {
  let socket = new WebSocket("ws://localhost:8080/ws-setup/websocket")
  return <div>Testing Page</div>
}

Postman: Set type to Raw, add 'ws://localhost:8080/ws-setup/websocket' and click connect. It tells me the connection was established in the messages viewport.

Configuration file in Spring Boot:

@Override
public void configureMessageBroker(final MessageBrokerRegistry config)
{
    config.enableSimpleBroker("/branches-ws");
    config.setApplicationDestinationPrefixes("/ws");
}

@Override
public void registerStompEndpoints(final StompEndpointRegistry registry)
{
    registry
            .addEndpoint("/ws-setup")
            .setAllowedOrigins("*")
            .withSockJS();
}

Why is it not working?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda