[GH-ISSUE #3872] [bug]: Unable to Connect to WebSocket #1360

Open
opened 2026-03-16 19:59:15 +03:00 by kerem · 6 comments
Owner

Originally created by @ashikkabeer on GitHub (Feb 28, 2024).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/3872

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Attempting to connect to a WebSocket using Socket.IO in Hoppscotch results in a 'Failed to connect' message. However, the same configuration is successful when using Postman.

image
image

I expect the WebSocket connection to be established successfully.

Steps to reproduce

  1. Open Hoppscotch desktop client.
  2. Create a new Socket.IO connection request.
  3. Click 'Connect' to establish the connection.

Environment

Production

Version

Local

Originally created by @ashikkabeer on GitHub (Feb 28, 2024). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/3872 ### Is there an existing issue for this? - [X] I have searched the existing issues ### Current behavior Attempting to connect to a WebSocket using Socket.IO in Hoppscotch results in a 'Failed to connect' message. However, the same configuration is successful when using Postman. ![image](https://github.com/hoppscotch/hoppscotch/assets/97529548/8d3e30c0-3ecc-4d49-adc0-90cdad445d69) ![image](https://github.com/hoppscotch/hoppscotch/assets/97529548/76e3758f-e93a-4054-b764-6712f3a92575) I expect the WebSocket connection to be established successfully. ### Steps to reproduce 1. Open Hoppscotch desktop client. 2. Create a new Socket.IO connection request. 3. Click 'Connect' to establish the connection. ### Environment Production ### Version Local
Author
Owner

@x-tropy commented on GitHub (May 10, 2024):

Second this. (having problem with connecting local hosted socket.io v4)

image

Tried chrome extension as interceptor:
image

Added localhost origin:
image

Postman is okay with this use case:
image

<!-- gh-comment-id:2104126252 --> @x-tropy commented on GitHub (May 10, 2024): Second this. (having problem with connecting local hosted socket.io v4) ![image](https://github.com/hoppscotch/hoppscotch/assets/5955526/c08ad9f7-5174-4ee3-b732-9b491878d580) Tried chrome extension as interceptor: ![image](https://github.com/hoppscotch/hoppscotch/assets/5955526/c685ac4c-a35f-457b-9b36-2364ff55f8a3) Added localhost origin: ![image](https://github.com/hoppscotch/hoppscotch/assets/5955526/5684fb28-7dad-435d-8a8f-3be4ef45bf0f) Postman is okay with this use case: ![image](https://github.com/hoppscotch/hoppscotch/assets/5955526/b7f202d7-230e-44f7-b979-b6bb4c883069)
Author
Owner

@x-tropy commented on GitHub (May 10, 2024):

I have set up the local server this way:

const PORT = 3000
const app = express()
const server = http.createServer(app)
const io = new Server(server, {
	cors: {
		origin: ["http://localhost:3000"],
		methods: ["GET", "POST"]
	}
})

server.listen(PORT, () => {
	console.log(`Server is running on port ${PORT}`)
})
<!-- gh-comment-id:2104137926 --> @x-tropy commented on GitHub (May 10, 2024): I have set up the local server this way: ```js const PORT = 3000 const app = express() const server = http.createServer(app) const io = new Server(server, { cors: { origin: ["http://localhost:3000"], methods: ["GET", "POST"] } }) server.listen(PORT, () => { console.log(`Server is running on port ${PORT}`) }) ```
Author
Owner

@Disservin commented on GitHub (Aug 30, 2024):

fyi, that is the error

image

saying (for dev purpose)

const io = new Server(server, {
  cors: {
    origin: ["tauri://localhost"],
  },
});

and then connecting to http://localhost:3000 in hoppscotch works.

<!-- gh-comment-id:2320740763 --> @Disservin commented on GitHub (Aug 30, 2024): fyi, that is the error <img width="881" alt="image" src="https://github.com/user-attachments/assets/b47126a0-084e-4b92-a16b-e67da46eeecb"> saying (for dev purpose) ``` const io = new Server(server, { cors: { origin: ["tauri://localhost"], }, }); ``` and then connecting to `http://localhost:3000` in hoppscotch works.
Author
Owner

@ThiLourenco commented on GitHub (Sep 14, 2024):

Same problem here, I can connect, but then it disconnects.

image

<!-- gh-comment-id:2351225047 --> @ThiLourenco commented on GitHub (Sep 14, 2024): Same problem here, I can connect, but then it disconnects. ![image](https://github.com/user-attachments/assets/97743c99-afe4-4b01-a25c-0e8db789fcc7)
Author
Owner

@ThiLourenco commented on GitHub (Sep 18, 2024):

I fixed using typing

const socket = connection

image

<!-- gh-comment-id:2357259351 --> @ThiLourenco commented on GitHub (Sep 18, 2024): I fixed using typing **const socket = connection** ![image](https://github.com/user-attachments/assets/b4fddbf3-1238-4fbd-914f-21f7837cf87b)
Author
Owner

@ThiLourenco commented on GitHub (Sep 18, 2024):

image

<!-- gh-comment-id:2357260666 --> @ThiLourenco commented on GitHub (Sep 18, 2024): ![image](https://github.com/user-attachments/assets/0b2aeb4e-711a-479f-9f85-1bafb8260d99)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#1360
No description provided.