Skip to content

stliakis/pubsuby

Repository files navigation

Pubsuby

A simple ready to deploy Pub-Sub over REST using Redis as a broker written in typescript.

Usage

You can the try pubsuby live on pubsuby.xyz, just be careful because everyone can subscribe to the service and listen to your messages.

Listen for messages in topics

let socket = new WebSocket("wss:https://pubsuby.xyz/api/subscribe?topic=test-topic");

socket.onmessage = function (e) {
    const {topic, payload} = JSON.parse(e.data)
    console.log("received:", topic, payload)
}

Publish events

axios.post("https://pubsuby.xyz/api/publish",{
  headers:{
      "secret-api-key": "notsecretapikey"
  },
  data:{
    topic: "test-topic",
    payload: {
      "message": "Hello World"
    }
  }
})

Running locally

git clone [email protected]:stliakis/pubsuby.git;
cd pubsuby;
SECRET_API_KEY=my-secret-api-key docker-compose up;

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published