Skip to main content

a TUI program to chat with friends on a LAN

Project description

ChatLan

preview image

an easy to use chat app command line interface tool

ChatLan is a lightweight command-line interface (CLI) tool designed to facilitate peer-to-peer chatting over a Local Area Network (LAN). It allows users to easily spin up a chat server and connect to it from different machines on the same network without complex configuration.

Table Of Contents

Install

In order to use ChatLan, you must install it with the following command:

pip install chatlan

Quick overview

In order to use Chatlan you have two options

the most common use flow being the following

  1. First, let's start a ChatLan Server with the command:
$ chat init

this will show the following screen: server app TUI

  • At your left is a list of all the poeple connected to the server as a the table

for example:

username address
you 192.168.1.9
mobsy 192.168.1.25
mob 192.168.1.11

[!NOTE] The First row is always the server

  • At your right is the Chat View Were everything every events(New Connection/Disconnection,etc) /messages are displayed

[!NOTE] For now the server doesn't can't send it's own messages, will be implemented in the next update

  1. In order for anyone to chat just need to use the following command:
$ chat connect ADDRESS 

for example if someone wants to connect to the server '192.168.1.9:8888' as 'Mobsy' they must run

$ chat connect 192.168.1.9:8888 -u Mobsy
# or also
$ chat connect -u Mobsy 192.168.1.9:8888

Then the user can chat as Mob as long as the server is running:

The Client App Interface

[!IMPORTANT] The Users and The Server must be on the same network/wifi

Commands

chatlan is in the first place a command line interface program (CLI) the command name of the ChatLan is chat

the availvable commands are:

the chat command doesn't do anythig by itself, except displaying a help menu

$ chat

this will show the following chat command help menu

  • init

Usage: chat init [options]

Initialize a chatlan server at the host ip address

init command help menu

  • options:

    • -p, --port <PORT> [DEFAULT: 8888]:

      <PORT> must be an integer between 8000 and 9000

      if ignored the default ChatLan PORT (8888) is used

    • -- help:

      Display the help menu

  • connect

Usage: chat connect <ADDRESS> [options]

Connect to a ChatLan Server

connect command help menu

  • arguments:

    • <ADDRESS>:

      the address of the ChatLan Server.

      this argument is a string in the format IP:PORT

      i.e:

        192.168.1.9:8888
        192.168.1.10:8888
      

    [!NOTE] The any ADDRESS with '127.0.0.1' as the IP are invalid

  • options:

    • -u, --username [DEFAULT: your machine hostname]:

      this option is the name you wish to use for the chat session.

      by default your username is your machine hostname

      i.e: 'mob-hpprobook'

      [!NOTE] If your username contains spaces you must surround it with quotes or double quotes (i.e: "Cool User")

Examples

In This section are snippets on actual use case of ChatLan

Starting A ChatLan Server

The most basic approach is to use

$ chat init

note that this running the above command will start a ChatLan Server on the 8888 port.

Why is this important ?

This is due to the fact that the server must be started on a port that's not used by any programm

for example the vscode extension Live server/Five Server runs on the 8000 port

so if you have Live Server Running on and run chat init -p 8000

ChatLan won't be able to start the server as Live Server is already using the 8000 port

This also means that if you run chat init and see an error this is very likely because another service is already using the 8888 port

To solve this you must try to run The ChatLan server on another port 8815 for example

[!IMPORTANT] In This Version ChatLan doesn't prevent you to start a server on an 'unreachable address' an address is juged unreachable if the IP part of the ADDRESS is either 127.0.0.1 or 0.0.0.0

Connecting to a ChatLan Server

In order o connect to a ChatLan server you must check two thing

  1. your computer is connected to a LAN or WLAN (wifi for example)

  2. A ChatLan Server is running

  3. Your Computer and The ChatLan Server are on the same network

the most 'rough' use of the connect command is:

$ chat connect <ADDRESS>

[!NOTE] When a ChatLan server is started it will display 'Server Started Successfully at ADDRESS' in the first line of the Chat View, the ADDRESS is what the clients must pass to chat connect

for example let's say i wanna connect to the ChatLan server 192.168.1.9:8888

i'll run

$ chat connect 192.168.1.9:8888

this will connect me to the server as 'mob-hpprobook'

why 'mob-hpprobook' ? that's oddly specific...

Well if you run chat connect without using the -u,--username option ChatLan is going to use your machine hostname as your username

In my case this is 'mob-hpprobook'

What if i want to have a cool username ?

Simple, just add the -u or --username option followed by your USERNAME

for example if i prefer 'Mobsy' rather than 'mob-hpprobook'

i just need to run

$ chat connect <ADDRESS> -u Mobsy
# or
$ chat connect -u Mobsy <ADDRESS>

in our previous example this will be

$ chat connect 192.168.1.9:8888 -u Mobsy
# or
$ chat connect -u Mobsy 192.168.1.9:8888

[!NOTE] If the username you wish to use contains Spaces like 'Cool User 2025' you must surround the USERNAME with quotes (') or double quotes (")

$ chat connect 192.168.1.9:8888 -u "Cool User 2025"
# or
$ Chat connect -u "Cool User 2025" 192.168.1.9:8888

Notes & limitations

[!IMPORTANT] No Secure Messaging System: The message aren't actually encrypted, so don't use ChatLan for a professional/marketing context

  • Same network required: Clients and server must be on the same LAN/Wi-Fi network.

  • No server-side chat input (yet): Server cannot send messages from the UI in this release — planned for the next update.

  • User table: The server TUI shows connected users dynamically (username + IP). Disconnects are handled and reflected in the table.

  • Address validation: Addresses containing 127.0.0.1 are treated as invalid for client connections (client must reach server on LAN IP).

Planned features:

  • server broadcast input
  • message widget UI.
  • user random colors.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chatlan-0.1.1.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chatlan-0.1.1-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file chatlan-0.1.1.tar.gz.

File metadata

  • Download URL: chatlan-0.1.1.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.11 Linux/6.17.9-arch1-1

File hashes

Hashes for chatlan-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a00183b94585b2e132260a7d11fd0078f5ddb00b176cd33f5bb6f1197f744f5c
MD5 71a125b81a2973400580acc1bf6078f3
BLAKE2b-256 d11ec28874ef4438e4bbec999eb19099b2a5be91abc9c54d7d8ce16e60a20007

See more details on using hashes here.

File details

Details for the file chatlan-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: chatlan-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.11 Linux/6.17.9-arch1-1

File hashes

Hashes for chatlan-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 982cf6e3c2ac0aba39d28d20969d3be51b6a271a8550cc95fccb7f4fed7dd95f
MD5 3281e91585af75ba19932b89568e37a3
BLAKE2b-256 1fb33ba31533a57c6544878bb8215cec0eb3f1986e75f0ebfe4511f3cfbd2d15

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page