Lantern
WebSocket Support
Supported WebSocket Methods
In addition to answering RPC requests about cached accounts, Lantern supports the following WebSocket methods:
accountSubscribe
Subscribe to account changes
accountUnsubscribe
Unsubscribe from account updates
programSubscribe
Subscribe to program account changes
programUnsubscribe
Unsubscribe from program updates
signatureSubscribe
Subscribe to receive transactions that match the supplied signature. This feature requires that Lantern is set up with a paid API key. A free one won't work.
signatureUnsubscribe
Unsubscribe to a specific signature.
blockSubscribe
Subscribe to receive blocks as Lantern receives them. This feature requires that Lantern is set up with a paid API key. A free one won't work.
blockUnsubscribe
Unsubscribe from blocks, to stop receiving them.
slotSubscribe
Subscribe to slot updates, at processed confirmation. This feature requires that Lantern is set up with a paid API key. A free one won't work.
slotUnsubscribe
Unsubscribe from slot updates, to stop receiving them.
You can access these methods as usual — just make your requests to the Lantern port in your config file.
Usage
Subscribing to an account or program that Lantern is caching will work normally and provide real-time updates as the data changes.
The exact behavior when subscribing to accounts or programs Lantern is not caching depends on the cache_requests setting in your configuration:
cache_requests = true
Subscribing to an uncached account will cause Lantern to fetch and begin caching it. After this, subscriptions work as expected. Note: caching System or Token Program accounts can consume significant bandwidth — a Scale plan at FluxRPC is recommended.
Subscribing to an uncached program will fail (returns "not found"). To subscribe to a program, add it to your config file explicitly.
cache_requests = false
Subscribing to an account or program that Lantern is not currently caching will fail (returns "not found").
Regardless of configuration, trying to subscribe to an account or program that doesn't exist will fail (returns "not found").