Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I run SignalR hub through Azure API Management?

I have the same question as this guy: can I run my SignalR hub through the Azure API management service?

enter image description here

I cannot seem to configure it in the service: it only allows me to forward HTTP/HTTPS traffic. That matches the answer of the person in the forum post. I followed the link down to the Microsoft forum, but it seems the question wasn't followed up there. Since the response was from 2014, I thought - maybe it is possible now.

like image 362
Jochen van Wylick Avatar asked Jun 12 '15 06:06

Jochen van Wylick


People also ask

What is SignalR in Azure?

Azure SignalR Service simplifies the process of adding real-time web functionality to applications over HTTP. This real-time functionality allows the service to push content updates to connected clients, such as a single page web or mobile application.

What is Azure API management backend?

A backend (or API backend) in API Management is an HTTP service that implements your front-end API and its operations. When importing certain APIs, API Management configures the API backend automatically. For example, API Management configures the backend when importing: An OpenAPI specification.


2 Answers

websocket is currently not supported in Azure API Management. Please feel free to raise a feature request: http://feedback.azure.com/forums/248703-api-management/filters/new

like image 113
Miao Jiang Avatar answered Sep 17 '22 12:09

Miao Jiang


As we know, the Azure API Management still doesn't support WebSockets

Dec 6, 2016:
Rest assured we still have this request in mind and are continually reviewing it. Please keep your feedback coming!

If you are using Azure SignalR Service then you can follow the way described by @lazizanie because your SignalR service should only provide a negotiate endpoint:

enter image description here

Let's say you have the Hub named myHub in ASP.NET Core 3.1

app.UseEndpoints(endpoints => endpoints.MapHub<Hub>("/myHub"));

Then add operation in API management URL=POST /myHub/negotiate with negotiateVersion query param

or use JSON editor and add it to paths

"/myHub/negotiate": {
    "post": {
        "summary": "SignalR negotiate ",
        "operationId": "signalr-negotiate",
        "parameters": [{
            "name": "negotiateVersion",
            "in": "query",
            "schema": {
                "type": ""
            }
        }],
        "responses": {
            "200": {
                "description": null
            }
        }
    }
}

For the Backed set host of your SignalR service like https://myHubSignalR.westeurope.cloudapp.azure.com

like image 44
Roman Marusyk Avatar answered Sep 20 '22 12:09

Roman Marusyk