Skip to content
This repository has been archived by the owner on Sep 24, 2021. It is now read-only.

jamen/rela-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

rela-json

rela-json is a Rela middleware to provide JSON-events on the Client object.

Usage

rela-json provides one new addition to the Server object's prototype. Which is .select. But first we have to load rela-json:

var rela = require('rela'),
    app = rela();

app.use(require('rela-json'));

// ...

Server.prototype.select

A key to orientate your events around. (Default: "method")

Examples

const rela = require('rela'),
      app = rela();

app.use(require('rela-json'));

app.select('do'); // Set key to listen on.

app.on('connection', function(client){
  client.on('example', function(data){
    console.log(data);
  });
});

We can trigger the "example" event from the client with the following JSON:

{
  "do": "example",
  // ...
}

About

(Archived) JSON-event middleware for rela.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published