The id of the custom message to listen for, module-resolved like input/output ids.
The function to call when a message with this id is received. The handler receives the message data as its parameter. Inline arrow functions are safe to pass — the handler is stored in a ref internally, so a new function reference on each render won't cause the message handler to be deregistered and re-registered.
A React hook for handling messages from the Shiny server.
This hook registers a message handler with Shiny that will be called when the server sends a message with the specified id using
send_message()(which is a wrapper forsession.send_custom_message()with extra functionality.)The hook waits for Shiny to initialize before registering the handler and properly manages the handler lifecycle, re-registering when dependencies change.