Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
318 stars 53 forks source link

Add WebSocket support #1487

Open jeremyraadttwins opened 3 weeks ago

jeremyraadttwins commented 3 weeks ago

Is your feature request related to a problem? Please describe. I would like to request WebSocket support for Azure Static Web Apps. I understand there are current API constraints that prevent this. I have an Angular app that calls my API, hosted in Azure App Service, which uses SignalR. That API has endpoints like "/api/hubs/messages" that the client can connect to and get SignalR messages.

When trying to connect, my client gets the following error message:

Error: Failed to start the connection: Error: Unable to connect to the server with any of the available transports. Error: WebSockets failed: Error: WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled. ServerSentEvents failed: Error: 'ServerSentEvents' is disabled by the client. LongPolling failed: Error: 'LongPolling' is disabled by the client.

Describe the solution you'd like I would like to be able to call "/api/hubs/messages" and have it connect to my SignalR API hub.

Describe alternatives you've considered I could try ServerSentEvents or LongPolling, but I really would like web sockets to work.