Git Product home page Git Product logo

wsnotifier's Introduction

wsnotifier

Build Status

wsnotifier is a lightweight gevent based asynchronous websocket server written in Python. wsnotifier exposes HTTP APIs for forwarding the messages to the websocket clients. This makes it easier to use the service with any web application. It's completely written in Python and doesn't depend on external systems like Redis for storing/retrieving messages.

wsnotifier components

Installation

You can install using pip

$ pip install git+https://github.com/semk/wsnotifier.git

Or using docker

$ docker pull semk/wsnotifier

Running wsnotifier server

$ wsnotifier
Starting wsnotifier on ws://0.0.0.0:1729/alerts and http://0.0.0.0:1729/alerts

Or using docker

$ docker run -p 1729:1729 --rm -it semk/wsnotifier
Starting wsnotifier on ws://0.0.0.0:1729/alerts and http://0.0.0.0:1729/alerts

Connecting to wsnotifier via a websocket client

wscat is a nice commandline websocket client. You can install it by

$ npm install -g wscat

Connect to the websocket server at ws://0.0.0.0:1729/alerts

$ wscat -c ws://localhost:1729/alerts
connected (press CTRL+C to quit)

Posting messages to wsnotifier for forwarding to websocket clients.

You can use any HTTP client to send the messages. This will be forwarded to all the connected websocket clients asynchronously. A Python client for wsnotifier is available here

$ curl -X POST -H "Content-Type: application/json" -d '{"id": "unique-message-id", "type": "important", "message": "important message"}' http://0.0.0.0:1729/alerts
{"status": "success"}

You can see the forwarded message appearing on the wscat client instantly.

$ wscat -c ws://localhost:1729/alerts
connected (press CTRL+C to quit)
< {"message": "important message", "type": "important", "id": "unique-message-id"}
>

wsnotifier's People

Contributors

semk avatar

Stargazers

Anand P Prabhu avatar Jefro avatar  avatar  avatar

Watchers

 avatar James Cloos avatar

Forkers

multicoin-co

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.