back

pubsub

Terminal publish-subscribe protocol over Java sockets.

Terminal publish-subscribe protocol for text messages.

// overview

pubsub is a Java socket application for topic-based terminal messaging. Clients register as publishers or subscribers, exchange messages by topic, and inspect topic history through command-driven flows.

The project focuses on network programming and concurrency: a server accepts multiple clients, dispatches each connection through a thread pool, and stores topic and user state in concurrent collections.

// how it works

ServerSocket accepts clients and runs ClientHandler instances with ExecutorService. Each handler processes registration, show, list, listall, quit, and message broadcast commands.

The server exposes operator commands for topic inspection, message deletion, topic clearing, user lookup, client kicking, and exporting messages by topic or user.

// capabilities

Publisher/subscriber roles

Publishers can send and list their messages; subscribers can read topic history.

Concurrent client handling

Uses a cached thread pool plus concurrent maps and queues for active clients and topic messages.

Inspect mode

Lets the server pause topic writes, inspect messages, delete entries, and resume queued client commands.

Message export

Writes topic or user message histories to timestamped log files.