koorchik / node-mole-rpc

Transport agnostic spec compliant JSON RPC client and server
MIT License
61 stars 13 forks source link

Implement ping/pong mechanism to check server availability #26

Closed artemtrush closed 1 year ago

artemtrush commented 1 year ago

Problem: we need to handle server availability for some transports (ws,mqtt) that don't support transport-level pings. WS actually support pings, but this API is not available in browser.

Solution: Create app-level ping/pong mechanism via exposing internal methods.

There is also an idea to return SERVICE_UNAVAILABLE error for callMethod until our ping succeeds. In this case, it also requires implementing some Fast-Recovery approach to increase ping frequency in case of error. But it seems a bit over-engineering for this task.

Autotests passed New tests added