MCPcopy Create free account
hub / github.com/CPChain/chain / CreateSubscription

Method CreateSubscription

api/rpc/subscription.go:80–86  ·  view source on GitHub ↗

CreateSubscription returns a new subscription that is coupled to the RPC connection. By default subscriptions are inactive and notifications are dropped until the subscription is marked as active. This is done by the RPC server after the subscription ID is send to the client.

()

Source from the content-addressed store, hash-verified

78// are dropped until the subscription is marked as active. This is done
79// by the RPC server after the subscription ID is send to the client.
80func (n *Notifier) CreateSubscription() *Subscription {
81 s := &Subscription{ID: NewID(), err: make(chan error)}
82 n.subMu.Lock()
83 n.inactive[s.ID] = s
84 n.subMu.Unlock()
85 return s
86}
87
88// Notify sends a notification to the client with the given data as payload.
89// If an error occurs the RPC connection is closed and the error is returned.

Callers 8

SomeSubscriptionMethod · 0.80
HangSubscriptionMethod · 0.80
traceChainMethod · 0.80
NewHeadsMethod · 0.80
LogsMethod · 0.80
SyncingMethod · 0.80
PeerEventsMethod · 0.80

Calls 3

NewIDFunction · 0.85
LockMethod · 0.80
UnlockMethod · 0.80

Tested by 2

SomeSubscriptionMethod · 0.64
HangSubscriptionMethod · 0.64