useAppMessage
useAppMessage({ onAppMessage?: Function}) : Object
Convenience hook for the daily-js sendAppMessage() method.
useAppMessage can also set up an optional callback for the app-message event.
Params (optional)
An object with the following properties:
onAppMessage(optional):Function, callback for theapp-messageevent. When anapp-messageis sent, the callback will be called with two arguments:
| Name | Type | Description |
|---|---|---|
ev | Object | The original event payload sent from daily-js |
sendAppMessage | Function | The function reference that was created internally inside useAppMessage. This avoids having to call the hook twice in order to respond to an app-message with an app-message |
Return type
| Name | Type | Description |
|---|---|---|
sendAppMessage | Function | See sendAppMessage() instance method in daily-js |