ethers.js icon indicating copy to clipboard operation
ethers.js copied to clipboard

Handle WebSocket close and reconnect in WebSocketProvider

Open Dustin4444 opened this issue 8 months ago • 0 comments

Fixes #1053

Implement WebSocket reconnection and keep-alive mechanism in WebSocketProvider.

  • Add onclose, onping, and onpong event handlers to handle WebSocket close events and maintain connection.
  • Utilize the #connect method for reconnection purposes.
  • Add logic to re-establish subscriptions and pending requests on reconnection.
  • Include a keep-alive mechanism with ping-pong to maintain the WebSocket connection.
  • Modify src.ts/providers/provider-websocket.ts and lib.esm/providers/provider-websocket.js to reflect these changes.

For more details, open the Copilot Workspace session.

Dustin4444 avatar Apr 10 '25 02:04 Dustin4444