Can't connect to a Node.js web app websocket

Olga Milovanova 21 Reputation points
2020-08-07T04:32:42.567+00:00

WebSocket connection to 'wss://sound-mazing.azurewebsites.net/?encoding=text' failed: Error during WebSocket handshake: Unexpected response code: 503

I followed the steps here to deploy and enable websockets in my Web app on Linux: https://learn.microsoft.com/en-us/azure/app-service/app-service-web-get-started-nodejs
According to this post, I expect to see my app running on port 80 or 443: https://stackoverflow.com/questions/42053499/socket-io-neterr-connection-refused/42062626#42062626

In the log I see that it picks up 8080 from process.env.PORT and correct url address:
2020-08-07T04:18:55.775274135Z 2020-08-07T04:18:55.775Z app Multi-peer Adapter listening on {"address":"::","family":"IPv6","port":8080}
2020-08-07T04:18:55.776195970Z 2020-08-07T04:18:55.776Z app baseUrl: https://sound-mazing.azurewebsites.net

This is docker log, again, I expected to see port 80 or 443 mapped to the container. I don't use Docker, this is the default 'Code' deployment.
2020-08-07T03:57:28.328Z INFO - docker run -d -p 6288:8081 --name sound-mazing_0_90fa6b26_middleware -e WEBSITE_CORS_ALLOWED_ORIGINS=* -e WEBSITE_CORS_SUPPORT_CREDENTIALS=False -e WEBSITE_SITE_NAME=sound-mazing -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=sound-mazing.azurewebsites.net -e WEBSITE_INSTANCE_ID=d8d03614bc510cc5857017d2e5db96abd9ca95b7444ce9f96afd5266abaaa99e appsvc/middleware:1.2.8 /Host.ListenUrl=http://0.0.0.0:8081 /Host.DestinationHostUrl=http://172.16.1.3:8080 /Host.UseFileLogging=true

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,748 questions
0 comments No comments
{count} votes

Accepted answer
  1. SnehaAgrawal-MSFT 21,506 Reputation points
    2020-08-07T13:53:29.167+00:00

    Thanks for asking question! Just to confirm if you are running on Linux Free sku,

    "Web Sockets are not currently supported for Linux apps on Free App Service Plans. We are working on removing this limitation and plan to support up to 5 web socket connections on Free App Service plans."

    You may refer to this document link on this: https://github.com/MicrosoftDocs/azure-docs-pr/blob/5850b96a8d55b57db5889b2c45f6d4cdb4849d5d/articles/app-service/containers/app-service-linux-faq.md#web-sockets

    Let me know if you have further question on this.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

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.