4.0.3 • Published 4 years ago

bloggify-ws v4.0.3

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

bloggify-ws

Version Downloads

Websockets for Bloggify Actions!

:cloud: Installation

# Using npm
npm install --save bloggify-ws

# Using yarn
yarn add bloggify-ws

:clipboard: Example

///// Client (browser)
const ws = require("bloggify-ws");

const socket = ws("my-action", (err, data, cb) => {
    if (err) {
        /* The server sent an error */
        /* Or got disconnected (e.g. server down, internet down) */
    }

    /* do something with data coming from the server */
    // ...

    /* Send something back to the server */
    cb(null, {
        foo: "bar"
    })
})

// Send data to the server
socket.data(/* ... */)

// Send an error to the server
socket.error(/* ... */)

///// Server
///// (in `app/actions`)
const action = Bloggify.actions.ws("my-action", (err, data, cb) => {
    if (err) {
        /* The client sent an error */
    }

    /* do something with data coming from the client */
    // ...

    /* Send something back to the client */
    cb(null, {
        foo: "bar"
    })
})

// Send data to the client
action.data(/* ... */)

// Send an error to the client
action.error(/* ... */)

:question: Get Help

There are few ways to get help:

  1. Please post questions on Stack Overflow. You can open issues with questions, as long you add a link to your Stack Overflow question.
  2. For bug reports and feature requests, open issues. :bug:

:yum: How to contribute

Have an idea? Found a bug? See how to contribute.

:scroll: License

MIT © Bloggify

4.0.3

4 years ago

4.0.2

4 years ago

4.0.1

6 years ago

4.0.0

6 years ago