diff --git a/rpc/subscription.go b/rpc/subscription.go index e10dfe8169ccc..3231c2ceec9b5 100644 --- a/rpc/subscription.go +++ b/rpc/subscription.go @@ -32,7 +32,15 @@ import ( ) var ( - // ErrNotificationsUnsupported is returned when the connection doesn't support notifications + // ErrNotificationsUnsupported is returned by the client when the connection doesn't + // support notifications. You can use this error value to check for subscription + // support like this: + // + // sub, err := client.EthSubscribe(ctx, channel, "newHeads", true) + // if errors.Is(err, rpc.ErrNotificationsUnsupported) { + // // Server does not support subscriptions, fall back to polling. + // } + // ErrNotificationsUnsupported = notificationsUnsupportedError{} // ErrSubscriptionNotFound is returned when the notification for the given id is not found