Messages in JS

From Yate Documentation
(Difference between revisions)
Jump to: navigation, search
 
(2 intermediate revisions by 2 users not shown)
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
  
  
Line 10: Line 27:
 
|-
 
|-
 
|class="yate-content-right"|
 
|class="yate-content-right"|
<div class="bullet">&nbsp;</div><font class="yate-page-title">[[Install handler for using Yate's messages in Javascript]]</font><br/>
+
* [[Install handler for using Yate's messages in Javascript]]
<div class="yate-page-desc">How to install handler fot messages from Javascript.</div>
+
How to install handler for messages from Javascript.
<div class="bullet">&nbsp;</div><font class="yate-page-title">[[MessageQueue]]</font><br/>
+
* [[Singleton (separate) message handler context in Javascript]]
<div class="yate-page-desc">The MessageQueue is a mechanism for organizing Yate's messages in different queues.</div>
+
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.
 
|}
 
|}
  

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