From 65a240cb179c91d525ecfa0a9d26b11cd8805fb8 Mon Sep 17 00:00:00 2001 From: Chad Engler Date: Tue, 2 Oct 2012 10:38:45 -0400 Subject: [PATCH] Event docs update --- README.md | 72 +++++++++++++++++++++++++------------------------------ 1 file changed, 33 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index ffbcf54..57c76a5 100644 --- a/README.md +++ b/README.md @@ -134,29 +134,30 @@ just do the same yourself, but the function is here to meet the interface. ### Library Events -Below is a comprehensive list of the events that an `esl.Connection` instance will emit, along with parameters, -and description. You can listen to any event like this: +Below is a comprehensive list of the events that the library can emit, along with parameters, and description. -```javascript -var conn = new Connection('127.0.0.1', 8021, 'clueCon'); -conn.on('ready', function() { - -}); -``` +Both the `esl.Connection` and `esl.Server` objects use [`EventEmitter2`](https://github.com/hij1nx/EventEmitter2) +to send namespaced events. For example every event raises the `esl::event::EVENT_NAME::EVENT_UUID` event, where +`EVENT_NAME` is the name of the event and `EVENT_UUID` is the uuid of the event. Listening to `esl::event::*` will +give you every event with any name with any uuid; whereas `esl::event::MESSAGE::*` will give you only each MESSAGE +event, reguardless of uuid. -The `esl.Connection` object uses [`EventEmitter2`](https://github.com/hij1nx/EventEmitter2) to -send namespaced events. For example every event raises the `esl::event::` event, where -`` is the name of the event. Listening to `esl::event::*` will be called everytime an -event is fired. +#### `esl.Connection` Events Here is the event list in the form of `event_name(param1 {type1}, ..., paramN {typeN})`:
-
ready()
+
error(err {Error})
+
An error has occurred, this is not namespaced to `esl::` as to match node's error event system
+ +
esl::connect()
+
The connection has connected to FSW, but has not authenticated.
+ +
esl::ready()
The connection is ready; it is both connected and authenticated.
-
error(err {Error})
-
An error has occurred +
esl::end()
+
The connection to FreeSWITCH has closed
esl::*([evt {esl.Event}])
Will pick up any esl event emitted from the Library, including `connect` and other events with no parameters
@@ -164,53 +165,46 @@ Here is the event list in the form of `event_name(param1 {type1}, ..., paramN {t
esl::event::*(evt {esl.Event})
Called each time an event is picked up from FSW by the Client
-
esl::event::EVENT_NAME(evt {esl.Event})
-
Each event where the "body" is actually an event is emitted on this channel where EVENT_NAME is the Event's Event-Name header value
+
esl::event::EVENT_NAME::*(evt {esl.Event})
+
Each event is emitted on this channel where `EVENT_NAME` is the Event's `Event-Name` header value
esl::event::EVENT_NAME::EVENT_UUID(evt {esl.Event})
-
Each event is emitted with a UUID, the EVENT_UUID is determined by first checking for a `Job-UUID` (background job uuid), then `Unique-ID` (channel uuid), and finally the `Core-UUID` (message's uuid). This to tracka particular job, channel, or message stream.
- -
esl::connect()
-
The connection has connected to FSW, but has not authenticated.
+
Each event is emitted with a UUID, the `EVENT_UUID` is determined by first checking for a `Job-UUID` (background job uuid), then `Unique-ID` (channel uuid), and finally the `Core-UUID` (message's uuid). This to track a particular job, channel, or message stream.
-
esl::end()
-
The connection to FreeSWITCH has closed
- -
esl::auth::*([evt {esl.Event}])
+
esl::event::auth::*([evt {esl.Event}])
Picks up any auth event, whether it is `request`, `success`, or `fail`
-
esl::auth::request(evt {esl.Event})
+
esl::event::auth::request(evt {esl.Event})
FSW has requested authentication from the Library; The Library with auth for you.
-
esl::auth::success()
+
esl::event::auth::success()
Authentication with FSW has passed; the `readyCallback`, if specified, is also called.
-
esl::auth::fail()
+
esl::event::auth::fail()
Authentication with FSW has failed
-
esl::command::reply(evt {esl.Event})
+
esl::event::command::reply(evt {esl.Event})
A reply to an issued command has come back
-
esl::api::response(evt {esl.Event})
+
esl::event::api::response(evt {esl.Event})
A response to an issued api command has come back
-
esl::channel::data(evt {esl.Event})
-
A CHANNEL_DATA event has reached the Library; this only happens on initial connection of "Outbound" sockets.
- -
esl::log::data(evt {esl.Event})
+
esl::event::log::data(evt {esl.Event})
A log event from FSW
-
esl::disconnect::notice(evt {esl.Event})
+
esl::event::disconnect::notice(evt {esl.Event})
FSW has notified the library it will be disconnected
-
esl::raw::*(evt {esl.Event})
+
esl::event::raw::*(evt {esl.Event})
Captures any raw event that had a Content-Type the Library did not parse
-
esl::raw::CONTENT_TYPE(evt {esl.Event})
-
Any Content-Type not parsed by the library is emmited on this channel, where CONTENT_TYPE is the Event's Content-Type header value
+
esl::event::raw::CONTENT_TYPE(evt {esl.Event})
+
Any Content-Type not parsed by the library is emmited on this channel, where `CONTENT_TYPE` is the Event's `Content-Type` header value
-And here are the events that will be emitted by `esl.Server`; it also uses EventEmitter2: +#### `esl.Server` Events + +Here is the event list in the form of `event_name(param1 {type1}, ..., paramN {typeN})`:
connection::open(connection {esl.Connection})