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

88
Views
Socket.IO cannot establish a connection

I use socket.io-client for Javascript server on JAVA and when I enter address 'ws://10.201.223.67:9902/' the request is not by 'ws' but by 'http'. enter image description here

It returns enter image description here

Although I understand it should just come back 0 enter image description here

It keeps trying to connect.To connect using my own written hook

export function useSocketIO(url: string) {
const ioRef = useRef<Socket>();
const [connected, setConnected] = useState(false);

useEffect(() => {
ioRef.current = io(url, {
  transportOptions: {
    polling: {
      extraHeaders: {
        Authorization: `Bearer ${APIAuth.accessToken}`,
      },
    },
  },
});
ioRef.current.on('connect', () => {
  console.log('WS Connected to', url);
  setConnected(() => true);
});

ioRef.current.on('disconnect', () => {
  console.log('WS disconnected');
  setConnected(() => false);
});

return () => {
  console.log('WS destroyed');
  ioRef.current?.close();
};
}, [url]);

return {
io: ioRef.current,
connected,
 };
 }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Are you using any framework to handle the websocket? Java can't do this natively, it doesn't know what the ws:// protocol is.

about 4 years ago · Juan Pablo Isaza Report
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!