Skip to content

SantanuKar43/tiny-pubsub-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tinypubsub

tinypubsub is a minimal, in-memory TCP-based publish–subscribe server written in Go. This is a toy project built to explore Go concurrency, channels, and event-driven design.

There is no persistence and no durability. Restarting the server resets all state.


Features

  • TCP server using Go’s net package
  • Simple text-based protocol
  • In-memory topic subscriptions
  • Fan-out message delivery using Go channels
  • Single event loop for state mutation

Build

make build

This builds the binary at:

./bin/tinypubsub

Run

./bin/tinypubsub

The server listens on port 9000.


Usage

Connect using nc (netcat):

nc localhost 9000

Commands

SUB <topic>          Subscribe to a topic
UNSUB <topic>        Unsubscribe from a topic
PUB <topic> <msg>    Publish a message to a topic
LIST                 List subscribed topics
EXIT                 Close the connection

Example

SUB sports
PUB sports hello world
LIST
UNSUB sports
EXIT

Notes

  • All state is in-memory
  • No authentication
  • No persistence
  • Not safe for production use

This project exists purely for learning and experimentation.

About

A toy pub/sub TCP server written in Go.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors