Skip to content

Commit

Permalink
Remove retry limit for websocket
Browse files Browse the repository at this point in the history
This commit removes the limit on WebSocket failures. Previously, the
code set a maximum number of failures before falling back to other
transports and using them for all subsequent re-connections. The purpose
of this limit was to improve re-connection time for clients experiencing
repeated issues with WebSocket transport.

However, it is now believed that this limit is unnecessary. Today, the
occurrence of such issues is less common, and the limit may have
unintended consequences. For example, in the current approach, a modern
web browser with a temporary bad internet connection could exhaust its
chances to use WebSocket and be left with slower fallbacks for the
remainder of the session.

By removing this limit, we enable indefinite retries for WebSocket.

This behavior is extensively explained in the following blog posts.
https://pusher.com/blog/how-we-built-pusher20-part-1/
https://pusher.com/blog/how-we-built-pusher-js-2-0-part-2-implementation/
https://pusher.com/blog/how-we-built-pusher-js-2-0-part-3-metrics/
  • Loading branch information
amad committed Jun 14, 2023
1 parent c2bb30f commit f3f1718
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/runtimes/isomorphic/default_strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ var getDefaultStrategy = function(
};

var ws_manager = new TransportManager({
lives: 2,
minPingDelay: 10000,
maxPingDelay: config.activityTimeout
});
Expand Down
1 change: 0 additions & 1 deletion src/runtimes/web/default_strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ var getDefaultStrategy = function(
};

var ws_manager = new TransportManager({
lives: 2,
minPingDelay: 10000,
maxPingDelay: config.activityTimeout
});
Expand Down

0 comments on commit f3f1718

Please sign in to comment.