Skip to content

This application was meant to relay some backend data to a web interface instantly and refreshless via socket.

Notifications You must be signed in to change notification settings

JnMik/nodejs-notification-bridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This application was meant to relay some backend data (PHP, python, anything..) to a web interface instantly and refreshless via socket. POST on /notification route are forwarded on socket directly.

Init project

$ cp config.js.dist config.js

Start nodejs notification bridge server

$ node server.js

Usage on client side

<script src="https://cdn.socket.io/socket.io-1.3.7.js"></script>
<script>
  // creating a new websocket
  var socket = io.connect('http://localhost:8000/');

  socket.on('notification', function (data) {
      console.log(data);
  });
</script>

Try the notification bridge with Postman or cURL running some POST call on /notification route

$ curl -H "Content-Type: application/json" -X POST -d '{"warning":"investigate X"}' http://localhost:8000/notification

About

This application was meant to relay some backend data to a web interface instantly and refreshless via socket.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published