single file apinator client sdk#3
Open
barbatosotos wants to merge 2 commits into
Open
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Apinator Client — single-file browser build
Why
ready to use combines: connection.ts · channel.ts · auth.ts · index.ts with bug fixed
How
[FIX 1] Reset inactivity timer on every message while connected.
The original code only reset the timer once (on connection_established), so after activity_timeout seconds the client would send a ping and risk dropping an otherwise healthy connection that was still exchanging data.
[FIX 2] Original code stopped retrying after 6 attempts forever. Schedule one more attempt after a longer cooldown so the client can recover from server restarts or extended network partitions without the caller having to call connect() manually.
[FIX 3] Clear the socket ID whenever we leave "connected". The original code left the old ID in place after a disconnect, so a stale ID could reach the auth endpoint before a new connection_established was received.
[FIX 4] resetActivityTimer() Cancel both phases so a fresh inactivity window begins now. Previously both phases wrote to the same
activityTimervariable, so the pong-wait phase overwrote the reference to the inactivity phase and neither could be cancelled independently.Checklist