Socket.io - WebSocket is closed before the connection is established

Lucas Brito 1 Reputation point
2022-06-22T21:19:29.823+00:00

Hi!
We're experiencing difficulties with socket.io connections.
As simultaneous accesses increase, connections are closed before being established.

We identified SNAT exhaustion incidents and provisioned a NAT Gateway, however, even after the SNAT exhaustion incidents disappeared (in the last six hours), connections continue to be closed with the message 'WebSocket is closed before the connection is established'.
The perMessageDeflate is already set to false.

We did load tests in the development environment and the failure did not show up.

Are there any limitations related to bidirectional communication/websockets that we are not aware of?

Service Type: Web App for Containers
OS: Linux
Base Image: node:16-alpine

Thank you all for the attention.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Lucas Brito 1 Reputation point
    2022-07-01T12:51:14.79+00:00

    Hello everybody.
    Thanks for the support and here are some conclusions:

    • The problem was related to SNAT exhaustion;
    • Following the NAT Gateway integration documentation was not enough. Without defining NSG and private endpoints, the backend service would fail when trying to communicate with some dependencies, which caused the process to crash;

    Thanks to Skylar Onstot for the support.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.