Take a look at the -walletnotify and -blocknotify runtime parameters, which update you on updates to the local node's wallet and any new block respectively. Note that you can't use these to receive immediate notifications of new transactions that don't directly affect the node's wallet, such as the creation of a new asset. For those you'll need to poll the memory pool using getrawmempool or getmempoolinfo.