jito-labs / jito-ts

Jito Typescript SDK
Other
92 stars 50 forks source link

onUpdate functions now return a function to cancel gRPC subscriptions #11

Closed futurekarol closed 1 year ago

futurekarol commented 1 year ago

there is currently no way to close existing grpc subscriptions. this is problematic if ie wanting to repeatedly subscribe to new accounts on geyser. after a while without closing the old subscription the library would reach grpcs maxConcurrentStreams limit.

this changes the return type of the onUpdate functions in geyser and searcher libs from void to () => void, which is a function to close the stream.

while at it added proper ts doc to the functions in searcher and geyser.