[GH-ISSUE #1614] Websocket (socket.io) not connecting #509

Closed
opened 2026-03-16 15:46:06 +03:00 by kerem · 10 comments
Owner

Originally created by @AllanOricil on GitHub (Apr 22, 2021).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1614

Originally assigned to: @blenderskool on GitHub.

Describe the bug
I have a websocket running alongside an express app and when I click "connect" in hoppscotch it displays an error message, but in the express side I can see a "connected" log displayed. So it means hoppscotch is hitting the websocket but it fails to retain the connection

image

Express Log

image

To Reproduce
Steps to reproduce the behavior:

  1. Attach a websocket using socket.io in an express app
  2. Open hoppscotch and hit "connect"

Expected behavior
It should connect

Screenshots
It is not connecting

Desktop (please complete the following information):

  • OS: Windows 10

Additional context
Express App dependencies

"dependencies": {
"@types/vscode": "^1.53.0",
"applicationinsights": "^1.8.2",
"axios": "^0.21.1",
"cors": "^2.8.5",
"dateformat": "^4.5.1",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"fs-extra": "^9.0.1",
"jsforce": "^2.0.0-beta.3",
"morgan-body": "^2.6.4",
"node-machine-id": "^1.1.12",
"objects-to-csv": "^1.3.6",
"open": "^8.0.2",
"qs": "^6.9.4",
"rotating-file-stream": "^2.1.3",
"socket.io": "^2.4.1"
}

Originally created by @AllanOricil on GitHub (Apr 22, 2021). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1614 Originally assigned to: @blenderskool on GitHub. **Describe the bug** I have a websocket running alongside an express app and when I click "connect" in hoppscotch it displays an error message, but in the express side I can see a "connected" log displayed. So it means hoppscotch is hitting the websocket but it fails to retain the connection ![image](https://user-images.githubusercontent.com/55927613/115769089-0ee7c880-a3a3-11eb-99ae-9bfada26f2e4.png) Express Log ![image](https://user-images.githubusercontent.com/55927613/115769190-2c1c9700-a3a3-11eb-9d5d-67497e4160d8.png) **To Reproduce** Steps to reproduce the behavior: 1. Attach a websocket using socket.io in an express app 2. Open hoppscotch and hit "connect" **Expected behavior** It should connect **Screenshots** It is not connecting **Desktop (please complete the following information):** - OS: Windows 10 **Additional context** Express App dependencies "dependencies": { "@types/vscode": "^1.53.0", "applicationinsights": "^1.8.2", "axios": "^0.21.1", "cors": "^2.8.5", "dateformat": "^4.5.1", "dotenv": "^8.2.0", "express": "^4.17.1", "fs-extra": "^9.0.1", "jsforce": "^2.0.0-beta.3", "morgan-body": "^2.6.4", "node-machine-id": "^1.1.12", "objects-to-csv": "^1.3.6", "open": "^8.0.2", "qs": "^6.9.4", "rotating-file-stream": "^2.1.3", "socket.io": "^2.4.1" }
Author
Owner

@AllanOricil commented on GitHub (Apr 22, 2021):

This other tool connects without a problem. Maybe it is because you are using socket.io 3? If so, there should be an option to choose socket.io version

image

<!-- gh-comment-id:825109808 --> @AllanOricil commented on GitHub (Apr 22, 2021): This other tool connects without a problem. Maybe it is because you are using socket.io 3? If so, there should be an option to choose socket.io version ![image](https://user-images.githubusercontent.com/55927613/115771416-cda4e800-a3a5-11eb-9e02-e0a79be2ad90.png)
Author
Owner

@liyasthomas commented on GitHub (Apr 22, 2021):

Thanks for reporting the issue. We'll take a look at it and get back to you.

<!-- gh-comment-id:825131593 --> @liyasthomas commented on GitHub (Apr 22, 2021): Thanks for reporting the issue. We'll take a look at it and get back to you.
Author
Owner

@AllanOricil commented on GitHub (Apr 23, 2021):

I think you will have three builds one for each socketio client version (2,3 4) and then give the option for the user to switch between them. You can have routes like

../socketio/3
../socketio/2
../socketio/4

Then on your dns you configure a CNAME for each build when the user reaches that particular route. The downside I see is that it will require a page reload :/

<!-- gh-comment-id:825851587 --> @AllanOricil commented on GitHub (Apr 23, 2021): I think you will have three builds one for each socketio client version (2,3 4) and then give the option for the user to switch between them. You can have routes like ../socketio/3 ../socketio/2 ../socketio/4 Then on your dns you configure a CNAME for each build when the user reaches that particular route. The downside I see is that it will require a page reload :/
Author
Owner

@AllanOricil commented on GitHub (Apr 23, 2021):

Oh I just found that we can have multiple versions of the same dependency using aliases. I just don't know if the imports will use the aliases or the lib.

<!-- gh-comment-id:825854443 --> @AllanOricil commented on GitHub (Apr 23, 2021): Oh I just found that we can have multiple versions of the same dependency using aliases. I just don't know if the imports will use the aliases or the lib.
Author
Owner

@blenderskool commented on GitHub (Oct 1, 2021):

@liyasthomas Can I experiment and try working on this?

<!-- gh-comment-id:931885155 --> @blenderskool commented on GitHub (Oct 1, 2021): @liyasthomas Can I experiment and try working on this?
Author
Owner

@liyasthomas commented on GitHub (Oct 1, 2021):

Hi @blenderskool, you're free to take a shot at this. Am assigning this issue to you, do let us know if you need any help understanding the codebase.

<!-- gh-comment-id:931886286 --> @liyasthomas commented on GitHub (Oct 1, 2021): Hi @blenderskool, you're free to take a shot at this. Am assigning this issue to you, do let us know if you need any help understanding the codebase.
Author
Owner

@blenderskool commented on GitHub (Oct 11, 2021):

@liyasthomas So I tried recreating the issue, and below are my findings:

  • Hoppscotch is using socket.io-client v4, and based on the compatibility chart, we cannot connect to servers running socket.io v2.
  • Also looking at the compatibility chart, socket.io-client v2 seems to widely support connecting to different versions of socket.io server, so we may try downgrading to that version on Hoppscotch and make appropriate changes.
  • The other option is that we show some kind of menu to users for selecting the socket.io-client version they'd prefer using, as @AllanOricil mentioned.
<!-- gh-comment-id:939953774 --> @blenderskool commented on GitHub (Oct 11, 2021): @liyasthomas So I tried recreating the issue, and below are my findings: - Hoppscotch is using socket.io-client v4, and based on the [compatibility chart](https://socket.io/docs/v4/client-installation/), we cannot connect to servers running socket.io v2. - Also looking at the compatibility chart, socket.io-client v2 seems to widely support connecting to different versions of socket.io server, so we may try downgrading to that version on Hoppscotch and make appropriate changes. - The other option is that we show some kind of menu to users for selecting the socket.io-client version they'd prefer using, as @AllanOricil mentioned.
Author
Owner

@liyasthomas commented on GitHub (Oct 11, 2021):

I'm not sure of if the imports supports multiple versions of the same package.

<!-- gh-comment-id:939958736 --> @liyasthomas commented on GitHub (Oct 11, 2021): I'm not sure of if the imports supports multiple versions of the same package.
Author
Owner

@blenderskool commented on GitHub (Oct 11, 2021):

@liyasthomas It might be possible via aliases. I'm not sure if this is a good idea if we are concerned about bundle sizes.

<!-- gh-comment-id:939967562 --> @blenderskool commented on GitHub (Oct 11, 2021): @liyasthomas It might be possible via [aliases](https://pnpm.io/aliases). I'm not sure if this is a good idea if we are concerned about bundle sizes.
Author
Owner

@abishekpp commented on GitHub (Jul 19, 2025):

still not solved

<!-- gh-comment-id:3091937887 --> @abishekpp commented on GitHub (Jul 19, 2025): still not solved
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#509
No description provided.