This can be only performed via a websocket connection, via eth_subscribe and eth_unsubscribe. These support filters, so we first need to implement Filtering. Possible subscription types also are almost the same as the filters (logs, blocks, pending tx). The only extra subscription which is not part of a filter is Syncing (but it’s trivial to implement).