Messages in JS: Difference between revisions
No edit summary |
No edit summary |
||
| (19 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
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:<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 | |||
{|class="yate-table" | {|class="yate-table" | ||
| Line 9: | Line 27: | ||
|- | |- | ||
|class="yate-content-right"| | |class="yate-content-right"| | ||
* [[Install handler for using Yate's messages in Javascript]] | |||
How to install handler for messages from Javascript. | |||
* [[Singleton (separate) message handler context in Javascript]] | |||
How to install a message handler using a separate context in Javascript. | |||
* [[MessageQueue]] | |||
The MessageQueue is a mechanism for organizing Yate's messages in different queues. | |||
|} | |} | ||
| Line 17: | Line 39: | ||
* [[Messages]] | * [[Messages]] | ||
* [[Javascript]] | |||
[[Category:Javascript]] [[Category:Programmers]] | |||
Latest revision as of 05: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