{"modulePath":"github.com/ethersphere/ethproxy","version":"v0.0.5","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package callback\n\n## Types\n\n```go\ntype Callback struct {\n\tsync.Mutex\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc New(logger logging.Logger) *Callback\n```\n\n```go\nfunc (c *Callback) Cancel(id int) error\n```\nCancel removes a callback based on an callback ID\n\n```go\nfunc (c *Callback) On(method string, f handlerFunc) int\n```\nOn adds a new callback based on an ethrpc method and returns the associated callback ID\n\n```go\nfunc (c *Callback) Register(id uint64, method string)\n```\nRegister keeps track of the ethrpc requests with ethrpc ID to ethrpc method name mapping. It must be called before callback.Run()\n\n```go\nfunc (c *Callback) Run(resp *Response)\n```\nRun, with the ID from the ethrpc response, finds the registered method name, and executes all callbacks associated with the method.\n\n```go\ntype Response struct {\n\tBody *ethrpc.JsonrpcMessage\n\tIP   string\n}\n```\n\n","path":"github.com/ethersphere/ethproxy/pkg/callback","name":"callback","synopsis":"","isRedistributable":true}
