Maintained copy of the Phoenix JavaScript client, based on 1.7.14.
The official npm package is phoenix. This repository is not a drop-in replacement for current 1.8.x; it keeps oVice-specific behavior that upstream still does not provide.
Compared with phoenixframework/phoenix (JS client / npm phoenix 1.8.x):
- Reconnect on WebSocket close code 1000. Upstream skips reconnect when the close code is 1000 (
closeCode !== 1000). This fork reconnects on 1000 and uses close code3000(WS_CLOSE_HEARTBEAT_TIMEOUT) for heartbeat timeouts, because browsers and networks sometimes close with 1000 even when a reconnect is required. - Separate heartbeat interval and timeout. Adds
heartbeatTimeoutMs. Upstream usesheartbeatIntervalMsfor both the send interval and the timeout. - Ghost reconnect timer during teardown. The reconnect timer sets
closeWasClean = truebeforeteardown(), soonConnClosedoes not schedule another reconnect. Under load this otherwise cycles connections before they open. - WebSocket leak when multiple teardowns run. Teardown captures the connection being closed and ignores later close/cleanup on a replaced socket. Upstream 1.8.x has a similar
connToClosefix. - Bundled TypeScript types. Ships
js/phoenix/index.d.ts. Official npmphoenixdoes not include types (@types/phoenixis a separate package). - Package exports and
globalinitialization. ESMexportspoint atjs/phoenix, andglobalis accessed in a way that avoidsReferenceError: Cannot access 'global' before initialization.
An upstream sync was attempted and reverted (PR #4 / #6) because newer upstream behavior (pageHidden reconnect pause, heartbeat close code 1000, closeWasClean changes) conflicts with the items above.