Skip to content

Sidney-Bernardin/PubSub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PubSub

Contents

  1. Overview
  2. Usage

Overview

PubSub is a TCP-based Pub/Sub server. It lets clients create/listen to topics and data that is published to specific topics by other clients.

For more on how this project works, visit my portfolio.

Usage

Install and run

Clone this repository.

git clone https://github.com/Sidney-Bernardin/PubSub.git
cd PubSub

Then run directly on your machine or with Docker.

Run directly on your machine.

go run . -addr=0.0.0.0:8080

Run with Docker.

You can use the pre-built image that's based on the Dockerfile at the root of this repository.

docker run -p 8080:8080 sidneybernardin/pubsub:latest

Sending Commands

Using a TCP client of your choice (like Telnet), you can send two types of commands to the server.

To create and listen to topics, use a subscribe command.

sub topic_a topic_b topic_c

To publish data to topics, use a publish command.

pub topic_a Hello, World!

All errors are returned in a JSON format and are easy to parse.

{"type":"invalid_command","detail":"Operation 'pub' requires a topic and topic-message as arguments."}