Does Azure Web PubSub with Socket.IO service support HTTP polling as fallback?

Vinayak Tavildar 20 Reputation points Microsoft Employee
2023-08-28T10:35:39.16+00:00

In case websocket fails, is there a guarantee that fallback to HTTP polling will work if the socket.io client tries to connect to 'Azure Web PubSub with Socket.IO' service?

Azure Web PubSub
Azure Web PubSub
An Azure service that provides real-time messaging for web applications using WebSockets and the publish-subscribe pattern.
75 questions
{count} votes

Accepted answer
  1. Kevin Guo 85 Reputation points Microsoft Employee
    2023-08-30T02:21:20.1933333+00:00

    @Vinayak Tavildar

    Hello Vinayak,

    Thank you for raising the question. To provide the full context, my answer is going to be a bit involved. But long story short, Web PubSub for Socket.IO fully supports upgrading from long-polling based mechanism to WebSocket-based.

    Involved answer.

    How Socket.IO the library works is that initially it connects with polling-based mechanism. When WebSocket is available, it then upgrades to WebSocket-based. Let's say somehow the WebSocket connection is disconnected. What the client library does is that it will try to reconnect. The reconnect will start a new connection. Because it's a new connection, it will try polling-based mechanism first and if then WebSocket is available. If WebSocket is not available, this new connection will stay polling-based.

    This is the behavior when using Socket.IO library and it remains the same when you use Web PubSub for Socket.IO.

    Let me know if it clarifies things for you.

    1 person found this answer helpful.
    0 comments No comments

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.