0.0.4 • Published 8 years ago

kotomono v0.0.4

Weekly downloads
4
License
-
Repository
-
Last release
8 years ago

kotomono

A customizable websocket library

How does it work?

Namespaces

The idea behind kotomono is to provide the utilities to build a flexible socket server. Kotomono allows you to set up namespaces.

A namespace can be any word (i.e. 'global' or 'push-notifications'). You can define events under the namespace which can manage all the sockets subscribed to that namespace.

var namespaces = {
  'global': {
    'join-ns': function(s, ..) {
    },
    'close': function (s, ..) {
      logger.info('A user disconnected.');
    }
  },
  'channel': {
    'user-count': function (s, ..) {
      logger.info('The event user-count was triggered.');
    },
    'message': function (s, ..) {
      socket.send(event);
    }
  },
  'push-notifications': {
    // ..
  }
}

module.exports = namespaces;

Customization

Kotomono provides a way to pass any customizable object to namespace events.