raff

1.0.6 • Public • Published
var Raff = require('raff')

Raff.createApp(function (app, socket, http) {
  app.get("/hello:name", function (req, res) {
    res.send({ name: req.params.name })
  })
})

// output => folder [logs], config file [config.js]

Config file

clustering: 0 [number of cores], 1 [number of cores +1], -1 [number of cores -1], false [without cluster] etc.
debug: 0 [no debug], 1[debug], 2 [debug, write to files]
toobusy: true/false [https://www.npmjs.com/package/toobusy]
socket: true/false [sockjs]
render:mpc: max pages cache

Socket

// with auth
Raff.createApp(function (app, socket, http) {
  socket.onConnect(function (user) {
    user.$on("auth", function (sid) {
      // user.save => user.id = sid
      user.save(sig, function (user) {
        // success
        user.auth()
      })
    })
  })
})

// without auth
Raff.createApp(function (app, socket, http) {
  socket.onConnect(function (user) {
    // 0 = event, 1 = function, 2 = limit length | default 1e6 (~1mb)
    user.$on("message", function (report) {
      user.$to("get-message", { 
        msg: report.msg 
      }, report.users)
    }, 1e6)
  })
})

to be continued

License

(The MIT License)

Copyright (c) 2016

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Readme

Keywords

Package Sidebar

Install

npm i raff

Weekly Downloads

0

Version

1.0.6

License

MIT

Last publish

Collaborators

  • raff