Express HTTP Server, and Socket.IO translator for APX API server
Simply add the initializer to the Apx config.
$ npm install apx apx-express-socket.io
var apx =apxstarttranslators: 'apx-express-socket.io'
As of writing we are using
Socket.IO 0.9.16. After quite a bit of research and testing for our test
suite it wont quite shut down correctly even when the HTTP server is closed. Express shuts down just fine
but Socket.IO uses an instance upstream that doesn't seem to want to shutdown and restart within our tests.
In order to get the tests passing we restructured our tests to use a single instance of the translator rather than restarting it for each section.
In production this should not cause a limitation however we are open to suggestions on how to better handle shutting Socket.IO down. That way when the translator is stopped it can truly be started again.
Enable or disable express also listening on the port.
Host for express to listen on will default to the express default otherwise
Port to listen on otherwise will default to 3000
Enable or disable the express connection logger explicitly. By default it will
be used during development and disabled when
NODE_ENV is set to
Set this to the root path of the static file server to be used with express. No static server will be setup if this variable is not set.
Array of routes that should be accepted.
express:routes:get: path: '/status' file: 'actions/status.js'post: path: '/page' file: 'actions/page.js' methods: 'list''find''findOne''save''remove'
Busboy is the HTTP multipart parser for the express translator. In order to configure busboy use any of the prescribed configuration options in the docs see here
express:busboy:limits:fileSize: 33554432 //32MB
Enable or disable Socket.IO also listening on the express port.
Configuration object to be passed to socket.io at call time.
Array of routes that should be accepted. These would be considered event listeners, eg
'socket-io':routes:status: 'actions/status.js'page: file: 'actions/page.js' methods: 'list''find''findOne''save''remove'
It is imperative to use redis to back Socket.IO in production or cluster environments. Here is an example of the configuration.
var redis =RedisStore =IOStore =redisPub: redisredisSub: redisredisClient: redis)apxstart'socket-io':config:store: IOStore
busboyto handle incoming file uploads