# keyval/on-message
Register (or clear) the callback for RESP3 push messages — pub/sub traffic
and other server-initiated pushes, which are not matched to a command
future.
## Syntax
[keyval/on-message $client $closure]
## Parameters
- `$client` — client from `keyval/connect`
- `$closure` — `{|msg| ...}` receiving the push value; `nil` clears it
## Examples
def got nil [keyval/on-message $rds {|msg| def got $msg}] [await [keyval/cmd $rds "SUBSCRIBE" "chan"]] [await [keyval/cmd $rds "PUBLISH" "chan" "payload"]] [await [keyval/cmd $rds "PING"]] # drain — pushes ride the same stream $got # → @{ "message" "chan" "payload" }
## Returns
`nil`, or `%Err{:message}` when the argument is not an open client. Only one
push callback is kept; a later registration replaces it.
## See Also
`keyval/cmd`, `keyval/close`, `keyval/resp-parse`