Messages in JS
Line 4: | Line 4: | ||
You can also create, a custom MessageQueue, to avoid usage of internal Yate's message queue, if you need to handle a specific message, that takes too long to be processed by Yate. | You can also create, a custom MessageQueue, to avoid usage of internal Yate's message queue, if you need to handle a specific message, that takes too long to be processed by Yate. | ||
+ | |||
+ | |||
+ | Yate message processing:<br/> | ||
+ | |||
+ | '''Enqueue:'''<br/> | ||
+ | Check if an installed MessageQueue matches it. Put it there if so. Message will be processed by it.<br/> | ||
+ | Otherwise: put message in Yate internal queue. Message will be taken by an internal worker and dispatched.<br/> | ||
+ | |||
+ | '''Dispatch:'''<br/> | ||
+ | * Find a message handler matching the message (name and any parameter(s) filter). Handle return value: | ||
+ | ** False: find another message handler | ||
+ | ** True (message is broadcast): find another message handler | ||
+ | ** True (message is not broadcast): stop processing | ||
+ | * Set message handled indication to boolean true if any handler returned true | ||
+ | * Call internal message dispatched function (see enqueue() function parameters) | ||
+ | * Pass message (read-only) and handled indication to installed post hooks matching it | ||
+ | * Return handled indication (boolean true/false) to caller | ||
Latest revision as of 07:42, 3 September 2024
From Javascript module (the same goes for external scripts) you can have access to all Yate's messages.
In order to receive a message you must install a handler.
You can also create, a custom MessageQueue, to avoid usage of internal Yate's message queue, if you need to handle a specific message, that takes too long to be processed by Yate.
Yate message processing:
Enqueue:
Check if an installed MessageQueue matches it. Put it there if so. Message will be processed by it.
Otherwise: put message in Yate internal queue. Message will be taken by an internal worker and dispatched.
Dispatch:
- Find a message handler matching the message (name and any parameter(s) filter). Handle return value:
- False: find another message handler
- True (message is broadcast): find another message handler
- True (message is not broadcast): stop processing
- Set message handled indication to boolean true if any handler returned true
- Call internal message dispatched function (see enqueue() function parameters)
- Pass message (read-only) and handled indication to installed post hooks matching it
- Return handled indication (boolean true/false) to caller
YATE's Messages in JavaScript |
How to install handler for messages from Javascript. How to install a message handler using a separate context in Javascript. The MessageQueue is a mechanism for organizing Yate's messages in different queues. |
See also