Coder Social home page Coder Social logo

fwcd / distributed-chat Goto Github PK

View Code? Open in Web Editor NEW
65.0 7.0 11.0 985 KB

Distributed peer-to-peer messaging app using Bluetooth LE mesh networks

License: Mozilla Public License 2.0

Swift 91.38% Dockerfile 1.00% JavaScript 5.38% CSS 0.37% Python 1.60% Shell 0.26%
distributed-systems bluetooth-low-energy mesh-networks chat ios vapor bluetooth bluetooth-le linux

distributed-chat's Introduction

Distributed Chat

Distributed Chat App CLI Simulation Protocol Simulation Server

Logo

Lock Screen Screenshot Channels Screen Screenshot Channel Screenshot

A distributed chat messenger that uses Bluetooth LE mesh networks.

  • Fully decentralized architecture, no server or Internet connection required
  • Message caching, delayed transmission
  • Public and private end-to-end-encrypted messaging channels
  • Voice messages, image, file and contact attachments
  • Full simulation environment with configurable nodes, links and much more included
  • Cross-platform, portable core

Components

The project consists of the following components:

  • DistributedChat: The abstract application, platform-independent, transport-independent (uses interface for broadcasting/receiving messages)
  • DistributedChatApp: The iOS implementation, uses Bluetooth LE as transport, does not require a server
  • DistributedChatCLI: The CLI implementation, uses either HTTP/WebSockets as transport with the simulation server or Bluetooth LE (WIP)
  • DistributedChatSimulationProtocol: The high-level JSON-based protocol used between CLI and simulation server
  • DistributedChatSimulationServer: The companion server for the CLI, relays messages between connected CLI nodes, provides web-interface for configuring links between nodes
  • Scripts: Scripts for launching CLI instances conveniently and for testing the BLE transport

The dependency graph between these packages looks like this:

             +-----------------+  +-----------------------------------+
             | DistributedChat |  | DistributedChatSimulationProtocol |
             +-----------------+  +-----------------------------------+
                      ^                      ^
                      |                      |
           +----------+-------------+   +---------+
           |                        |   |         |
+--------------------+ +--------------------+ +---------------------------------+
| DistributedChatApp | | DistributedChatCLI | | DistributedChatSimulationServer |
+--------------------+ +--------------------+ +---------------------------------+

 \__________________/   \______________________________________________________/
       iOS only                     cross-platform, for testing

Building and Running

First, make sure to have Swift 5.7+ or newer installed. Recent versions for Ubuntu and macOS can be found here.

Simulation Server

To run the simulation server, navigate into the directory DistributedChatSimulationServer and execute:

swift run

The web interface should now be accessible at http://localhost:8080.

CLI

To start a single instance of the CLI, make sure that the simulation server is running, navigate into DistributedChatCLI and execute:

swift run DistributedChatCLI --name Alice

You can substitute any name for Alice. Once the CLI has started, the chosen name should show up as a node in the simulation server's web interface.

For convenience, there is a bash script for starting multiple instances of the CLI together in a single tmux session. To use it, navigate into the root directory of this repository and run

Scripts/start_clis Alice Bob Charles Dave

...or however many clients you want to start. To stop all clients at once, press Ctrl + B then type :kill-session and press enter.

iOS app

Building and running the iOS app is only possible on macOS, so make sure to have the following available:

  • Xcode 14.1+
  • Swift 5.7 (should be included with Xcode)
  • optionally an iOS device

The open the DistributedChatApp subdirectory in Xcode and build/run the project.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.