Skip to content

cw2030/tcp-chat

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Inquirer Logo

TCP Chat

Simple, quick and lightweight chat built over TCP and Rust.



Overview

TCP Chat is a simple chat made in Rust with a communication over TCP. The purpose of this project is learn about parallelism and low-level network communication.

This project doesn't want to replace any tool or being a new way to communicate, is just for learn Rust and has several issues (such as non-encrypted packets).

Stack

Frontend

Backend

Getting started

Since the project is built with Tokio, the standard library and Tauri, TCP Chat is multiplatform.

To start using TCP Chat you need to clone repository, install dependencies and build locally.

# Clone the repo
git clone https://github.com/gatomod/tcp-chat.git

# Build the server
cargo build --release -p server

# Build the client
cd client

pnpm i
pnpm tauri build

Then run it

# Init server
target/release/server

# By default, server is on port 3000
# Add an env variable to edit it
PORT=4848 target/release/server

# Start client
target/release/tcp-chat

How it works?

The server opens a TCP Listener. For each new connection spawns a thread and keeps open the connection. At this point, client and server can share the data (which is serialized in JSON, structs are defined in structs.rs).

When a connection sends a message, data is sent to server, which shares the packet between all threads and send the message to all connections.

Tauri receives the message and passes it to the web client.

Release history

  • 1.0.0
    • Initial release

License

TCP Chat is licensed under the GNU General Public License v.3.0.

Contribute

Any PR is welcome! Is a small project so the guideline is to follow the code style and not make insane purposes.

Note: typo errors will be declined.

Links

Web - Donate (via PayPal) - Discord - Revolt

Gátomo - GNU General Public License v.3.0 License

About

🎍 Simple, quick and lightweight chat built over TCP and Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 54.9%
  • Rust 42.7%
  • HTML 1.5%
  • Other 0.9%