Class: Subscription<T>
Represents an active WebSocket subscription.
This class should not be instantiated directly. It is returned by the
subscribe methods on the WebSocketChannel.
Example
const channel = new WebSocketChannel({ nodeUrl: 'YOUR_NODE_URL' });
await channel.waitForConnection();
// The 'sub' object is an instance of the Subscription class.
const sub = await channel.subscribeNewHeads();
sub.on((data) => {
console.log('Received new head:', data);
});
// ... later
await sub.unsubscribe();