Azure SignalR Service with APIM

ZHANG Hao.h 25 Reputation points
2023-05-08T03:50:48.9+00:00

I want to apply a reverse proxy on the Azure SignalR, I read the following document(https://learn.microsoft.com/en-us/azure/azure-signalr/signalr-howto-reverse-proxy-overview) seems Azure API Management can act as reverse proxy server as well.

The problem is that when I add a websocket API in APIM I have to add it as a separated API with different suffix, I can not have one API that handles both the following calls. I believe if I could add an HTTP Post operation in a websocket API then the problem is resolved. I can's see why it's not allowed. Any ideal how I can get this work?

HTTP post: <reverse-proxy-URL>/client/negotiate

Websocket: <reverse-proxy-URL>/client

Related threads:
https://stackoverflow.com/questions/69977531/does-it-possible-to-save-websocket-gateway-with-the-same-route-in-azure-api-mana

When a client goes through your reverse proxy to Azure SignalR, there are two types of requests:

  • HTTP post request to <reverse-proxy-URL>/client/negotiate, which we call as negotiate request
  • WebSocket/SSE/LongPolling connection request depending on your transport type to <reverse-proxy-URL>/client, which we call as connect request.
Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
1,939 questions
Azure SignalR Service
Azure SignalR Service
An Azure service that is used for adding real-time communications to web applications.
135 questions
0 comments No comments
{count} votes

Accepted answer
  1. MuthuKumaranMurugaachari-MSFT 22,271 Reputation points
    2023-05-09T15:39:29.8566667+00:00

    ZHANG Hao.h Thanks for posting your question in Microsoft Q&A. Please find the answers for your questions below:

    1. Currently it is not possible to add any operation other than onHandshake operation in WebSocket API including HTTP POST, and some limitations are detailed here.
    2. From your description and the referenced link, you have WebSocket API in APIM with URL suffix /client but unable to add HTTP API for the same suffix. You can add a new HTTP Api with suffix /client/negotiate, POST operation with suffix / to handle negotiate requests. This scenario might be helpful in some situations, and I would suggest you testing it out or consider alternate solution like Application Gateway. I found an article with similar scenario https://www.codit.eu/blog/using-api-management-websockets/ with different approach and thought it might be helpful for you.

    Our product team have backlog item for integrating APIM Management with SignalR and recommend you posting your feedback in https://aka.ms/apimwish. Others with similar interests can upvote your idea/feedback and that helps our product team to prioritize the features.

    I hope this helps with your question and let me know if you have any other questions.


    If you found the answer to your question helpful, please take a moment to mark it as "Yes" for others to benefit from your experience. Or simply add a comment tagging me and would be happy to answer your questions.


0 additional answers

Sort by: Most helpful