Skip to content

single file apinator client sdk#3

Open
barbatosotos wants to merge 2 commits into
apinator-io:mainfrom
barbatosotos:barbatosotos-patch-1
Open

single file apinator client sdk#3
barbatosotos wants to merge 2 commits into
apinator-io:mainfrom
barbatosotos:barbatosotos-patch-1

Conversation

@barbatosotos

Copy link
Copy Markdown

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 activityTimer variable, so the pong-wait phase overwrote the reference to the inactivity phase and neither could be cancelled independently.

Checklist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant