|
function | printError (error) |
|
function | invoke (handlers, argv) |
|
function | broadcastEvent (eventName, argv) |
|
function | broadcast (message) |
|
function | broadcastAppEventToUser (user, packageOwner, packageName, eventName, argv) |
|
function | getUser (caller, process) |
|
function | postMessageInternal (from, to, message) |
|
function async | getProcessBlob (blobId, key, options) |
|
ssb | addEventListener ('message', function() { broadcastEvent('onMessage', [...arguments]);}) |
|
function async | loadSettings () |
|
function | sendStats () |
|
Tilde Friends process management, in JavaScript.
◆ broadcast()
function broadcast |
( |
|
message | ) |
|
Send a message to all other instances of the same app.
- Parameters
-
- Returns
- A promise.
◆ broadcastAppEventToUser()
function broadcastAppEventToUser |
( |
|
user, |
|
|
|
packageOwner, |
|
|
|
packageName, |
|
|
|
eventName, |
|
|
|
argv |
|
) |
| |
Send a message to all instances of the same app running as the same user.
- Parameters
-
user | The user. |
packageOwner | The owner of the app. |
packageName | The name of the app. |
eventName | The name of the event. |
argv | The arguments to pass. |
- Returns
- A promise.
◆ broadcastEvent()
function broadcastEvent |
( |
|
eventName, |
|
|
|
argv |
|
) |
| |
Broadcast a named event to all registered apps.
- Parameters
-
eventName | the name of the event. |
argv | Arguments to pass to the handlers. |
- Returns
- A promise.
◆ getProcessBlob()
function async getProcessBlob |
( |
|
blobId, |
|
|
|
key, |
|
|
|
options |
|
) |
| |
Get or create a process for an app blob.
- Parameters
-
blobId | The blob identifier. |
key | A unique key for the invocation. |
options | Other options. |
- Returns
- The process.
◆ getUser()
function getUser |
( |
|
caller, |
|
|
|
process |
|
) |
| |
Get user context information for a call.
- Parameters
-
caller | The calling process. |
process | The receiving process. |
◆ invoke()
function invoke |
( |
|
handlers, |
|
|
|
argv |
|
) |
| |
Invoke a handler.
- Parameters
-
handlers | The handlers on which to invoke the callback. |
argv | Arguments to pass to the handlers. |
- Returns
- A promise.
◆ loadSettings()
function async loadSettings |
( |
| ) |
|
Load settings from the database.
- Returns
- The settings as a key value pairs object.
◆ postMessageInternal()
function postMessageInternal |
( |
|
from, |
|
|
|
to, |
|
|
|
message |
|
) |
| |
Send a message.
- Parameters
-
from | The calling process. |
to | The receiving process. |
message | The message. |
- Returns
- A promise.
◆ printError()
function printError |
( |
|
error | ) |
|
Print an error.
- Parameters
-
◆ sendStats()
Send periodic stats to all clients.
◆ callAppHandler
Invoke an app's handler.js.
- Parameters
-
response | The response object. |
app_blob_id | The app's blob identifier. |
path | The request path. |
query | The request query string. |
headers | The request headers. |
package_owner | The app's owner. |
package_name | The app's name. |
◆ g_handler_index
Effectively a process ID.
◆ gProcesses
◆ gStatsTimer
Whether stats are currently being sent.
◆ k_ping_interval
const k_ping_interval = 60 * 1000 |
Time between pings, in milliseconds.