Neo Saint Petersburg Competence Center (SPCC) has released an article introducing the new Websocket-powered remote notification subsystem, added by the team in the v0.75.0 release of NeoGo. The solution is intended to meet the backend needs of decentralized applications, providing an efficient system for monitoring and reacting to on-chain events such as smart contract executions.

Further, the protocol has an open specification so that compatible clients can be implemented in any language to meet the needs of developers. Historically, application builders using neo-cli, the core C# client, have been limited to creating plugins compatible with the node in order to receive contract notifications and backend operations.

The NeoGo notification subsystem currently supports a number of event types, with an individual stream for each: new blocks, new transactions, notifications generated during contract execution, and transaction execution results. These events are sent to clients as JSON-RPC notifications, ensuring that the interface is easy to use for existing applications with minimal adjustment.

To allow developers to limit events received to only the ones that are relevant for their applications, Neo SPCC has provided filtering functionality. For example, rather than receiving an event for every notification generated in a block, a script hash can be specified so that events are only received for the specific contract. Alternatively, the filter could be employed to exclude all transactions that ended in a FAULT state.

To begin receiving events, clients must first subscribe to the server using the provided subscribe method, passing the streams to receive and defining any filtering rules. The subscription response includes a temporary ID, which is used only to cancel the subscription.

The team has also highlighted an additional event that may be transmitted:

“There also is one very special event type: event_missed. We want dApp backends to be reliable and we don’t want them to lose any events, but obviously, if the client wouldn’t be able to receive events in time server queues might get overflown and that’s exactly when this event is being generated. You shouldn’t ever receive it, but if we wouldn’t be able to deliver your event at least you would know that.”

In addition to event subscriptions, the implementation also brings benefits to the existing NeoGO JSON-RPC server. Developers will be able to use Websockets to interface with the node for all basic RPC communication, intended as an improvement over the usual HTTP connections.

Further information about the remote notification subsystem can be found in the original article below: