-
-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[new] Allow WebSocket constructors to delay connection
Previously: WebSocket constructors returned a connected WebSocket. After this commit: WebSocket constructors may return: - nil (=> no WebSocket support), or - a delay (=> deref to return a connected WebSocket) In other words, we've decoupled construction and connection. The major advantage of this change is that it's now possible for the default `ChAutoSocket` (:auto type chsk) to distinguish between two kinds of errors: 1. The platform doesn't support WebSockets (=> fall back to Ajax) 2. The platform does support WebSockets, but current connection attempts are failing due to transient reasons like the internet being temporarily unavailable (=> keep retrying) Note: the new capability is implemented in such a way that we won't break pre-existing custom constructors. While constructors should ideally now return an unconnected delay, they MAY still directly return an already-connected socket.
- Loading branch information
1 parent
6021258
commit e330ef2
Showing
1 changed file
with
111 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters