actionhero

Actionhero is a realtime multi-transport nodejs API Server with integrated cluster capabilities and delayed tasks

APACHE-2.0 License

Downloads
14.5K
Stars
2.4K
Committers
127

Bot releases are hidden (Show)

actionhero - v12.1.2: FakeRedis

Published by evantahler about 9 years ago

There was a bug in FakeRedis which caused newly generated projects to fail. FakeRedis package updated with the fix.

actionhero - v12.1.1: Bugfix + Package Update

Published by evantahler about 9 years ago

actionhero - v12.1.0: compression in the web server

Published by evantahler about 9 years ago

Allow folks to optionally enable GZIP/Deflate compression for actionhero/servers/web. This can now be toggled on/off with api.config.servers.web.compress. While this option exists, it is still best-practice to have an upstream process handle compression rather than node, like Nginx or a load balancer.

When enabled, if the client indicates they can handle compressed responses (via the Content-Encoding header, we support gzip and deflate), Actionhero will compress results before sending the data over http. This decrease the network payload at the expense of both server and client CPU time.

By @evantahler via https://github.com/evantahler/actionhero/pull/689

actionhero - v12.0.0: Tighten it up.

Published by evantahler about 9 years ago

ioredis

We have replaced the node-redis package with ioredis. This new redis package is mostly api compatible with node-redis, but adds support for sentinel and cluster out of the box. It is also faster is most cases.

Optionally Enforce connection properties

In certain cases (perhaps streaming behind a load balancer) you many not be able to obtain both the connection.ip and connection.port for connecting clients. You can now toggle off this requirement with api.config.general.enforceConnectionProperties. Keep in mind that you may have trouble identifying and accessing unique connections with this option disabled.

Remove Stats Module

The api.stats module was very rarely used, so we removed it! This will reduce make actionhero a little bit leaner. If you want to continue to use api.stats, you can access it via a plugin: https://github.com/evantahler/ah-stats-plugin. Keep in mind that some of the core loggers (like number of active connections, actions, etc) have been removed. You can re-implement them via middleware and plugins.

Misc

  • We now test on Travis.CI with node v4.0... and yes, we are compatible!
  • Documentation updates by @evantahler and @kodypeterson
actionhero - v11.6.0: Package Upgrade

Published by evantahler about 9 years ago

Upgrade dependent packages

actionhero - v11.5.0: Custom Error Serializers

Published by evantahler about 9 years ago

Custom Error Serializers

  • You can now customize the way that Error object responses from your actions are serialized (probably into strings). Each web server has a matching method in api.config.errors.serializers[serverName] which returns the response type

Update Dependent Packages

actionhero - v11.4.3: Fix Grunt Console

Published by evantahler about 9 years ago

actionhero - v11.4.0: response signature for non-websocket connected actionhero client

Published by evantahler over 9 years ago

Bug Fix

  • munge non-ws connected actionhero client response to act like ws-connected actionhero client
    • This is a breaking change with regards to the response signature of connection.action for http/ws clients.
    • Now responses will all have the same signature: one param to the action, and data.error can be inspected
client.action("myAction", {thing: 'stuff'}, function(response){
  if(response.error){  
    // ...
  }else{
    // ...
  }
});
actionhero - v11.3.0: Chat onSayReceive Middleware

Published by evantahler over 9 years ago

Chat onSayReceive Middleware

  • Now in chat middleware, you can use register onSayReceive middleware. This will let you inspect/modify the message once (as it is sent in) rather than the say middleware which will be invoked once per client connected to the room. In many cases, this might be more efficient.
  • via https://github.com/evantahler/actionhero/pull/646 by @dunse

Misc

  • dependent package updates
  • documentation updates
actionhero - license

Published by evantahler over 9 years ago

Add the license to package.json

actionhero - v11.2.3: Package Updates

Published by evantahler over 9 years ago

  • Update various dependent packages to their latest versions
  • Fix a bug which may have duplicated messages received with say
actionhero - v11.2.2 Logging and Fixes

Published by evantahler over 9 years ago

Logging

  • api.config.logger.maxLogStringLength can now be used to truncate the length of params logged for actions
  • api.actionProcessor.prototype.logAction can now be monkeypatched for custom loggers of your actions (useful if your actions accept binary data!)

Misc

actionhero - v11.2.1 apiVersion in routes

Published by evantahler over 9 years ago

Configurable apiVersion in routes

Misc

  • Ensure that the env variable process.env.ACTIONHERO_SHUTDOWN_TIMEOUT is an integer when passed on the command line
  • Various fixes for error logging in actions
actionhero - v11.2.0: See your messages

Published by evantahler over 9 years ago

Clients which use say in chat rooms will now receive the message they send back in the normal broadcast way. This allows clients to display messages "you sent" if they wish. If you wish to ignore messages "you sent", simply don't show messages where client.id === message.from.

actionhero - v11.1.0: Failed Job Managment

Published by evantahler over 9 years ago

Implement new methods from https://github.com/taskrabbit/node-resque which make it easier to manage failed resque jobs:

api.tasks.failedCount(next)

  • next(err, failedCount)
  • failedCount is how many resque jobs are in the failed queue.

api.tasks.failed(start, stop, next)

api.tasks.removeFailed(failedJob, next)

  • next(err, removedCount)
  • the input failedJob is an expanded node object representing the failed job, retrieved via api.tasks.failed

api.tasks.retryAndRemoveFailed(failedJob, next)

  • next(err, failedJob)
  • the input failedJob is an expanded node object representing the failed job, retrieved via api.tasks.failed
actionhero - v11.0.0: New action syntax and simpler actionProcessor

Published by evantahler over 9 years ago

Actionhero Version 11.0.0

New action syntax and simpler actionProcessor

This allows us to remove the notion of connection._originalConnection from actions/middleware. This simplifies (and speeds up) the code and allows for the expected behavior of modifying data.connection within actions & middleware to persist.

!! This PR drastically changes the APIs of actions and middleware (breaking changes!). !!

Actions

Action Syntax now looks like this:

run: function(api, data, next){
  data.response.randomNumber = Math.random();
  next(error);
}

Where data contains:

data = {
  connection: connection,
  action: 'randomNumber',
  toProcess: true,
  toRender: true,
  messageCount: 123,
  params: { action: 'randomNumber', apiVersion: 1 },
  actionStartTime: 123,
  response: {},
}

Now, when you run an action, you modify data.response. If there is an error, you callback to next(err) with it.

If you don't want to toRender, just set it to false: data.toRender = false within the action.

Servers

When building custom servers, the response to an action is now:

server.on('actionComplete', function(data){
  completeResponse(data);
});

Where data is the same as in the action. Note that data.toRender should be inspected here. Any errors will be located in data.response.error.

Midleware (action)

Similar to actions, the syntax becomes:

api.actions.addPreProcessor(function(data, next){
  if(data.params.userId == null){
    var error = new Error( "All actions require a userId" );
    next(error);
  }else{
    next();
  }
});

This will solve https://github.com/evantahler/actionhero/issues/561

By @evantahler via https://github.com/evantahler/actionhero/pull/615


New Middleware Syntax

Action Middleware:

Action middleware syntax is now:

api.actions.addMiddleware(definition);
// I.E.
api.actions.addMiddleware({
  name: 'userId checker',
  global: false,
  priority: 1000,
  preProcessor: function(data, next){
    if(!data.params.userId){
      next(new Error('All actions require a userId') );
    }else{
      next(err);
    }
  }
  postProcessor: function(data, next){
    if(data.thing.stuff == false){
      data.toRender = false;
    }
    next(err);
  }
});
  • action middleware can now define both a preProcessor and postProcessor as a tuple.
  • action middleware by default is applied to no actions, unless you define definition.global = true
  • actions now opt into actions with the action.middleware array where names of actions are supplied which are to be invoked by each action, ie:
exports.randomNumber = {
  name: 'randomNumber',
  description: 'I am an API method which will generate a random number',
  outputExample: {
    randomNumber: 0.123
  },

  middleware: [ 'userId checker' ]

  run: function(api, data, next){
    data.response.randomNumber = Math.random();
    next(null);
  }

};

Connection Middleware:

Connection middleware syntax is now:

api.connections.addMiddleware(definition);
// I.E.
api.connections.addMiddleware({
  name: 'connection middleware',
  priority: 1000,
  create: function(connection){
    // do stuff
  },
  destroy: function(connection){
    // do stuff
  }
});
  • the connection middleware is still async (it has no callback; nor does it return). It will not block the connection being created.

by @evantahler via https://github.com/evantahler/actionhero/pull/625

Chat Middleware (say)

api.chatRoom.addMiddleware(definition);
// I.E.
api.connections.addMiddleware({
  name: 'connection middleware',
  priority: 1000,
  join: function(connection, room, callback){
    // do stuff
    callback(err);
  },
  leave: function(connection, room, callback){
    // do stuff
    callback(err);
  },
  say: function(connection, room, messagePayload, callback){
    // do stuff
    callback(err, messagePayload);
  }
});

Websockets

  • The params of websockets should NOT be sticky. All actions will start with connection.params = {}.

by @evantahler via https://github.com/evantahler/actionhero/pull/629


Complex Errors

  • Ensure that error responses from objects can be complex objects, IE:
var error = {error: true, message: 'something went wrong', code: 123};
next(error);

by @evantahler via https://github.com/evantahler/actionhero/pull/624


Misc:

  • Removed duplicate callback prevention in actionProcessor. This belongs on the user/implementer to handle.
actionhero -

Published by evantahler over 9 years ago

Update dependent packages

actionhero - v10.1.2

Published by evantahler over 9 years ago

Web Client Library Updates

Misc

  • fixed ability to stop/start/restart the server from within in action (ie: api.commands.stop())
  • Upgrade dependent packages to latest versions.
    • fakeredis
    • formidable
    • grunt
    • node-uuid
  • Various test suite fiexes
actionhero - v10.1.1

Published by evantahler over 9 years ago

Bugs:

Misc

  • Update node-resque and istanbul packages to latest versions