socket.io-notify

0.0.0 • Public • Published

Socket.IO Notify

A simple notification dispatcher written in nodeJS using socket.io

How to use

cd socket.io-notify
$ npm install
$ node .
 

Sending notifications

$ curl --request POST 'http://localhost:3000/send' --header apisecret:NOTIFICATION_SECRET --data 'notification=notificationexample&channel=SOME_CHANNEL'

Client side

 
document.addEventListener("DOMContentLoaded", function(event) {
  var socket = io.connect('127.0.0.1:3000', {
    query: 'notificationKey=NOTIFICATION_KEY'
  });
  socket.on('NEW_NOTIFICATION', function (notification) {
    console.log(notification);
  });
 
  socket.emit('join', 'SOME_CHANNEL');
});
 

Readme

Keywords

none

Package Sidebar

Install

npm i socket.io-notify

Weekly Downloads

2

Version

0.0.0

License

none

Last publish

Collaborators

  • viniciusdacal