Skip to content

Bloggify/bloggify-ws

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bloggify-ws

Version Downloads

Websockets for Bloggify Actions!

☁️ Installation

# Using npm
npm install --save bloggify-ws

# Using yarn
yarn add bloggify-ws

📋 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(/* ... */)

❓ 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. 🐛

😋 How to contribute

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

📜 License

MIT © Bloggify