JSPM

kn-lan-chat

0.0.2
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 1
    • Score
      100M100P100Q68801F
    • License MIT

    TCP LAN chat CLI for server/client messaging with private chat, broadcast, and IP ban management

    Package Exports

    • kn-lan-chat
    • kn-lan-chat/dist/server/tcps.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (kn-lan-chat) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    TCP LAN Chat CLI App

    A TypeScript + Node.js TCP chat application with a server CLI and client CLI. It supports multiple connected clients, private messaging, broadcast messaging, client listing, and IP ban management.

    Client Commands

    • -ccn <name>: set/change your client name
    • -cnum <number> <msg>: send message to client by list index
    • -cname <name> <msg>: send private message by client name
    • -cname <name>: set persistent private recipient mode
    • -rm: clear persistent recipient mode
    • -cn: show your current client name
    • -cl: list connected clients
    • -bc <msg>: broadcast to all clients (with y/n confirmation)
    • -h or -help: show command help
    • exit: disconnect client

    Persistent recipient mode flow:

    1) Run: -cname alice
    2) Type plain messages (without command prefix)
    3) Messages are sent to alice automatically
    4) Run: -rm to exit this mode

    Server Commands

    • -bc <msg>: broadcast server message to all clients (with y/n confirmation)
    • -cname <clientname> <msg>: send private message to client by name
    • -cnum <clientIndex> <msg>: send private message to client by index
    • -cl: show all connected clients on the server console
    • -ban <clientname>: ban client by name and disconnect them
    • -bf list: show ban list from banlist.txt
    • -bf clear: clear banlist.txt
    • -h or -help: show command help
    • exit: intended to stop server (use Ctrl+C as the reliable shutdown path)

    Message Routing Behavior

    • Private by name:
      • Client sends: -cname <target> <msg>
      • Recipient receives formatted private message.
    • Private by number:
      • Uses the index from -cl list.
    • Broadcast:
      • Sent to all other clients.
      • Sender gets success feedback.

    Ban System

    • Bans are IP-based.
    • BanManager stores in-memory bans and appends to banlist.txt.
    • On new connection, server checks both in-memory list and file list.
    • Banned clients are disconnected with a rejection message.

    If installed globally from npm, binaries are:

    npm i -g kn-lan-chat
    • klcs -> start server
    • klcc -> start client

    Quick Local Test

    Terminal 1:

    klcs -- -p 5000 -ip localhost -sn TestServer

    Terminal 2:

    klcc -- -p 5000 -ip localhost -cn karan1

    Terminal 3:

    klcc -- -p 5000 -ip localhost -cn user22

    Then test:

    • -cl
    • -cname user22 hello
    • -bc hello everyone
    • -ban user22 from server terminal

    License

    MIT