Check existing issues
Viem Version
2.46.3
Current Behavior
if (client.transport.type === 'webSocket') {
const websocket: ReturnType<WebSocketTransport>['value'] =
client.transport
const rpcClient = await websocket.getRpcClient()
rpcClient.close()
}
it just reconnects and never closes and the node process never exits
Expected Behavior
actually close the socket with reconnecting
Steps To Reproduce
No response
Link to Minimal Reproducible Example
No response
Anything else?
rpcClient.close() goes here
this call the underling socket .close() and triggers the onClose callback
- callback
this calls a
attemptReconnect()
- attemptReconnect calls
socket.close() again triggers again onClose callback
- after a delay runs
setup() again
Never closes, to be able to close properly you need to init with keepAlive: false and reconnect: false.
Check existing issues
Viem Version
2.46.3
Current Behavior
it just reconnects and never closes and the node process never exits
Expected Behavior
actually close the socket with reconnecting
Steps To Reproduce
No response
Link to Minimal Reproducible Example
No response
Anything else?
rpcClient.close()goes hereviem/src/utils/rpc/socket.ts
Line 222 in 1205d5a
.close()and triggers the onClose callbackviem/src/utils/rpc/socket.ts
Line 162 in 1205d5a
attemptReconnect()socket.close()again triggers again onClose callbacksetup()againNever closes, to be able to close properly you need to init with keepAlive: false and reconnect: false.