Actionhero is a realtime multi-transport nodejs API Server with integrated cluster capabilities and delayed tasks
APACHE-2.0 License
api.configData.webSockets.options
to contain a hash of settings to be bound to the websocket initializer (along with .settings which remains an array)node
in package.json to enable project to run on windowsnpm run-script actionHero generateInitializer
Boot
actionHero Binary
scripts
into a general actionHero
executable which can be found in ./node_modules/actionHero/bin/actionHero
and ./node_modules/.bin/actionHero
after npm install actionHero
actionHero start
and actionHero startCluster
from your project's root--config=[file]
which will allow you to specify other config.json(s) (IE: for development/staging envrionments)actionHero help
core API
clients
examples/clients/web/actionHeroWebSocket.js
Other
Binary
actionHero
generate will create a _project.js
initializer--daemon
. This will background the server or clusteractions
exports.userAdd = {
name: 'userAdd',
description: 'i add a user',
inputs: {
required: ['email', 'password'],
optional: []
},
outputExample: {},
run: function(api, connection, next){
// your code here
next(connection, true);
}
};
exports.userDelete = {
name: 'userDelete',
description: 'i delete a user',
inputs: {
required: ['email', 'password'],
optional: []
},
outputExample: {},
run: function(api, connection, next){
// your code here
next(connection, true);
}
}
config
general
Status Codes
api.configData.commonWeb.returnErrorCodes
, which when enabled will only return the http status code 200
for truly sucessful request (conneciton.error== null
), and an error HTTP response header when there is an error.connection.responseHttpCode
in your actions to indicate a specific HTTP error code for each request if something goes wrong.connection.responseHttpCode
when api.configData.commonWeb.returnErrorCodes
is enabled is 400
(bad request).404
(Bad Request).422
(Unprocessable Entity).initializers
_teardown(api, next)
will passed to this method_teardown
method is not requiredBugs
socket server & web sockets
listenToRoom
and silenceRoom
. You still need to be in a room to say
and interact with the room, but this will allow clients to register for additional events.room
paramite added to thier responses to allow for clarity in the above situation.connection.additionalListiningRooms
api.configData.general.simultaniousActions
. Defaults to 5
bugs
pipe
as to not require loading all of the file's content into ram to serve the fileinitializers can now have a _start(api, callback)
method which will be invoked when the server boots.
Bugs
api.tasks.inspect
has been renamed api.tasks.inspectTasks
as to work with console.log and util.inspectapi.configData.general.pidFileDirectory
Tasks
Tasks will no longer be 'popped' from a queue, but rather slid from queue to queue. This makes it much harder to loose a task
There is no longer a need for a periodc task reloader because of the above
Tasks can now be easily inspectd, and have been included in the status
task
Please check the wiki for new task syntax:
var task = new api.task({
name: "myTaskName",
runAt: new Date().getTime() + 30000, // run 30 seconds from now
params: {email: '[email protected]'}, // any optional params to pass to the task
toAnnounce: true // to log the run of this task or not
});
task.equeue(function(err){
// enqueued!
})
Stats
status
action now reflects the global status and local status for the server queriedapi.stats.increment(api, key, count, next)
api.stats.set(api, key, count, next)
api.stats.get(api, key, collection, next)
api.stats.collections.local
api.stats.collections.global
api.stats.getAll(api, next)
{global: globalStats, local: localStats}
General
This release changes (simplifies) a number of APIs, but it does introduce changes. Please read the wiki, specifically the API methods page, to learn the new syntax for various methods.
Allowing support to limit the connection.type for which an action if valid for. Define the array of action.blockedConnectionTypes = ['socket', 'webSocket']
for example to not allow access from TCP or webSocket clients. Not defining the array will allow all client types in.
Bugs
logger
api.configData.log
is replaced with api.configData.logger
api.configData.logger.transports
api.id
to use in your file namesapi.log(message, severity, data)
is the new syntaxapi.logger
tasks
!!! It is likley you will loose access to previously enqueued tasks with this upgrade
webserver
core
cluster
bugs
toRender = false
now are respected properlyapi.actions
is now a collection for all things action, and api.actions.actions
contail the list of actionscluster
Binary
start
rather than help
config
Bugs
listenToRoom
and silenceRoom
for websocket clients will not properly modify the messageCount id in the response objectwebServer
formidable
options to be passed via config. Details on the optons here: https://github.com/felixge/node-formidable
General
connection.sendMessage(message,type)
method which can be used globally. This will allow you to send a message to any connection directly without messing with chatroomsapi.webSockets
renambed to api.webSocketServer
to be consistant with other servershash
style filesWeb Sockets
Tasks
toAnnounce
is false, we will no silence the act of enquing delayed versions of this task (@macrauder)General
fake
can be toggled (boolean)Note
Config
config.js
to actionHero, you can also set the ACTIONHERO_CONFIG
envrionment variable.