W3WS.Handler.TimedRemovalHandler (w3ws v0.3.1)
Handler which filters out removed events using a time-delayed buffer.
Events are delayed until they are older than the configured :delay
.
If a removed: true
event is received before the :delay
has passed,
the handler will not pass the event to the underlying :handler
.
This handler is meant to be composed with other handlers.
Example
{:ok, listener} = W3WS.Listener.start_link(
uri: "http://localhost:8545",
subscriptions: [
[
abi_files: ["path/to/abi.json"],
handler: {W3WS.Handler.TimedRemovalHandler,
delay: :timer.seconds(2),
handler: W3WS.Handler.DefaultHandler},
topics: ["Transfer"],
address: "0x73d578371eb449726d727376393b02bb3b8e6a57"
]
]
)
Summary
Functions
Returns a specification to start this module under a supervisor.
GenServer handle cast callback.
Handle an event. Casts the event to the GenServer.
Initialize the handler. Requires a W3WS.Rpc.rpc/0
to be passed in the args
Returns true
if the handler has settled.
Functions
child_spec(init_arg)
Returns a specification to start this module under a supervisor.
See Supervisor
.
handle_cast(msg, state)
GenServer handle cast callback.
handle_event(env, handler)
Handle an event. Casts the event to the GenServer.
initialize(args)
Initialize the handler. Requires a W3WS.Rpc.rpc/0
to be passed in the args
settled?(state)
Returns true
if the handler has settled.