Add subscribe/unsubscribe RPCs. Add session, sessionManager, and serve JSON RPC (without HTTP). #66

Merged
moodyjon merged 16 commits from blockchain_rpc2 into master 2022-10-04 16:05:06 +02:00

16 commits

Author SHA1 Message Date
Jonathan Moody
5f068341e3 Use time.Ticker object to drive management activity. 2022-10-03 14:37:00 -04:00
Jonathan Moody
1eb645a0b9 HashXStatus, HashXMempoolStatus not populated by default. Fix GetStatus(). 2022-09-29 15:13:30 -05:00
Jonathan Moody
a91e9f82ff Add tests for headers, headers.subscribe, address.subscribe. 2022-09-29 12:12:38 -05:00
Jonathan Moody
3ddcbbb55d Changes to make session.go testable. Conn created with Pipe()
used in testing has no unique Addr.
2022-09-29 12:10:06 -05:00
Jonathan Moody
813fd4590a Add --max-sessions, --session-timeout args. Enforce max sessions. 2022-09-28 14:49:32 -05:00
Jonathan Moody
e56edf0c9a Handle failures with goto instead of break. Update error logging. 2022-09-28 11:26:30 -05:00
Jonathan Moody
c42a4689cd Only assign default port (50001) if neither --json-rpc-port nor
--json-rpc-http-port are specified.
2022-09-27 20:00:42 -05:00
Jonathan Moody
1d227dbca8 Support both pure JSON and JSON-over-HTTP services.
Forward NotifierChan messages to sessionManager.
2022-09-27 18:50:37 -05:00
Jonathan Moody
7f47de2949 Add core session/subscription logic (session.go).
Implement subsribe/unsubscribe handlers.
2022-09-27 18:50:36 -05:00
Jonathan Moody
b9cb9d8c5a Make the service objects independent, so we don't have inheritance. 2022-09-27 18:50:36 -05:00
Jonathan Moody
8c66d67a52 Implement GetStatus() to pull data from HashXStatus table. 2022-09-27 18:50:36 -05:00
Jonathan Moody
603a18f590 Drop http.Request arg from handlers, and use RegisterTCPService(). 2022-09-27 18:50:36 -05:00
Jonathan Moody
d03c992a25 Rename BlockchainService -> BlockchainBlockService. 2022-09-27 18:50:36 -05:00
Jonathan Moody
a5d07e0595 Pull out decode logic into named func newBlockHeaderElectrum(). 2022-09-27 18:50:35 -05:00
Jonathan Moody
2e666843f1 Move claimtrie-related service/handlers to jsonrpc_claimtrie.go. 2022-09-27 18:50:27 -05:00
Jonathan Moody
4005996992 Move and rename BlockchainCodec, BlockchainCodecRequest.
These are not specifically "blockchain", rather they are
specific to how gorilla/rpc works.
2022-09-27 17:07:16 -05:00