Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

180
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!