Messages in JS

From Yate Documentation
(Difference between revisions)
Jump to: navigation, search
 
(7 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.
 
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 handler for using Yate's messages in Javascript|install a handler]].
+
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
  
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 it's taken too long to be processed by Yate.
 
  
 
{|class="yate-table"
 
{|class="yate-table"
Line 9: Line 27:
 
|-
 
|-
 
|class="yate-content-right"|
 
|class="yate-content-right"|
<div class="bullet">&nbsp;</div><font class="yate-page-title">[[MessageQueue]]</font><br/>
+
* [[Install handler for using Yate's messages in Javascript]]
<div class="yate-page-desc">The MessageQueue is a mechanism for organizing Yate's messages in different queues.</div>
+
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 18: Line 40:
 
* [[Messages]]
 
* [[Messages]]
 
* [[Javascript]]
 
* [[Javascript]]
 +
 +
[[Category:Javascript]] [[Category:Programmers]]

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

Personal tools
Namespaces

Variants
Actions
Preface
Configuration
Administrators
Developers