stack-socket

0.0.1 • Public • Published

###Stack Socket

WIP / CONCEPT

The goal of stack socket is to wrap/abstract socket.io so that all commands in a given stack instance can operate through sockets, enabling you to fire stack commands on the client and receive them on the server or vice versa.

Example:

//server

var stack = require('stack-core')
require('stack-socket')(stack)

stack.on('test', (state, next) => {
  console.log('test ran')
  next(null, state)
})
//client

var stack = require('stack-core')
require('stack-socket')(stack)

stack.fire('test')


In the above example, the test command is fired and will reach the server; the server's listener will then output 'test ran'.

Supply additional config options via '_socket' property of state object. Ie:
stack.state._socket = { address: localhost:5202 }

Package Sidebar

Install

npm i stack-socket

Weekly Downloads

0

Version

0.0.1

License

MIT

Last publish

Collaborators

  • drschwabe