• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

253
Views
Socket.io is not returning a valid HTTP response

I am using socket.io and using this guide to implement it and the server is able to start up with no errors. But whenever I try connecting to the WebSocket from the server I am getting an error similar to this: Did not receive a valid HTTP response.

I am initializing socket.io with this code:

const socketio = new Server(http, {
  serveClient: false,
  pingInterval: 10000,
  pingTimeout: 5000,
});

Edit:

I am trying to connect to the WebSocket with this URL: ws://localhost:8000 using Python's WebSocket package. I used their example which is this:

import asyncio
import websockets

async def connect():
    await websockets.connect("ws://localhost:8000")

asyncio.run(connect())

Edit I made it work by using the wss package instead

almost 3 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Check the port the server is listening to and match both client and server. You should avoid low ports because those are used for common known apps and your system may piss you off by using them. 5 digits should be enough

almost 3 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 Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error