File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ export function resilientEventListener(args: ResilientEventListenerArgs) {
5454 logCb ( `[${ new Date ( ) . toISOString ( ) } ] Subscribing to event listener with topic hash(es): ${ topicHashes . join ( ', ' ) } ` ) ;
5555
5656 const requests = topicHashes . map ( ( topicHash , index ) => ( {
57+ jsonrpc : "2.0" ,
5758 id : index + 1 ,
5859 method : "eth_subscribe" ,
5960 params : [
@@ -67,8 +68,9 @@ export function resilientEventListener(args: ResilientEventListenerArgs) {
6768
6869 // sending this backs should return a result of true
6970 const ping = {
71+ jsonrpc : "2.0" ,
7072 id : requests . length + 1 ,
71- method : "net_listening " ,
73+ method : "net_version " ,
7274 params : [ ] ,
7375 } ;
7476
@@ -107,7 +109,7 @@ export function resilientEventListener(args: ResilientEventListenerArgs) {
107109 if ( requestIndex !== - 1 ) {
108110 subscriptionIds . push ( parsedData . result ) ;
109111 logCb ( `[${ new Date ( ) . toISOString ( ) } ] Subscription to event established with subscription ID '${ parsedData . result } '.` ) ;
110- } else if ( parsedData ?. id === ping . id && parsedData ?. result === true ) {
112+ } else if ( parsedData ?. id === ping . id && parsedData ?. result && ! isNaN ( Number ( parsedData . result ) ) ) {
111113 logCb ( `[${ new Date ( ) . toISOString ( ) } ] Health check complete, subscription is still active.` )
112114 if ( pingTimeout ) clearTimeout ( pingTimeout ) ;
113115 } else if ( parsedData ?. method === 'eth_subscription' && subscriptionIds . includes ( parsedData . params . subscription ) ) {
You can’t perform that action at this time.
0 commit comments