useSubscribeById
The useSubscribeById
hook is a wrapper around the useWebSocket
hook. This hook will subscribe to the device feed and filter the messages by the acp_id
. It can take a list of acp_id
s and will filter the messages by the acp_id
of the device that sent the message.
Parameters
id
: theacp_id
of the device to subscribe to
Returns
The hook returns the following:
messageHistory
: an array of all messages received from the serverlastMessage
: the last message received from the serverconnectionStatus
: the current connection status
Example Usage
const { messageHistory, lastMessage, connectionStatus } = useSubscribeById(id);