socketio / socketio/socket.io

Socket.io client connection through AWS Api Gateway

Open
#5,103 7 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

package:socket.io-client question
Dominant language
TypeScript
Stars
63.2k
Forks
10.3k
Avg merge
11d 20h
Merged PRs (30d)
2

Description

Hello. I am trying to create a connection like this: socket.io-client -> AWS Gateway API.
While trying to connect from socket.io client to an AWS Gateway API, connection can't be established.
It stucks with a status '101 switching protocols' for a few seconds, then throws 'disconnected' event and tries to reestablish connection, and the process repeats infinitely.
This doesn't happen with native WebSockets or 'ws' library though, everything connects like it should.
I think issue has something to do with how socket.io client and server sides interact with each other by exchanging certain messages which may not be generated on the AWS side of things.
So my question is: is that even possible to establish a connection like this without using proxies:
socket.io-client -> AWS Api Gateway -> socket.io(node.js),
or it always has to be Socket.io-client -> socket.io(node.js)?

Amazon AWS documention was used for configuring gateway: https://aws.amazon.com/blogs/compute/announcing-websocket-apis-in-amazon-api-gateway/
It uses standart $connect, $disconnect and $default routes, but instead of lambda its nodejs backend. The issue though is only on the client side.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository files, tests, or entry points are named. Start by reproducing the socket.io-client connection through AWS API Gateway and compare its handshake behavior with the native WebSocket and ws cases; done means establishing whether this topology is supported and documenting or resolving the incompatibility.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript, node.js
Domain
backend, cloud, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.