[FREE] Chat Client and Server

MIT App Inventor Community Chat Client and Server

Welcome to our MIT App Inventor Community project, where we are thrilled to offer a comprehensive client and server setup for chat applications. This project provides a MIT App Inventor-built chat client and a Java-based chat server that orchestrates encrypted communications.

Chat Server in Java

The heart of our communication platform is a Java chat server, crafted to enable secure message exchanges. It's designed to handle multiple connections, ensuring each message is encrypted and broadcast securely to connected clients.

Key Features:

  • Concurrent client management with multithreading
  • Robust AES encryption for message security
  • Server activity monitoring through console-based logging

How to Run:

  1. Clone or download the server Java files from the repository.
  2. Compile the server with javac ChatServer.java.
  3. Start the server using java ChatServer.

Make sure Java is installed on your system to compile and run the server.

MIT App Inventor Chat Client

Complementing our server is the MIT App Inventor chat client, which offers users a seamless and secure platform to send and receive messages right from their Android devices.

Highlights:

  • User-friendly interface for message exchange
  • End-to-end encryption for privacy and security
  • Seamless integration with the Java chat server

How to Use:

  1. Access the MIT App Inventor project and tailor it to your needs.
  2. Build the project within MIT App Inventor to generate an Android-compatible APK.
  3. Deploy the APK on your Android device and engage in secure conversations.

Enhancing Security

To further solidify the application's security posture, we're looking into adding SSL/TLS encryption for communication and incorporating a secure protocol for the exchange of AES keys.

Next Steps:

  • Implementation of SSL/TLS within the Java server for enhanced encryption.
  • Integration of a secure key exchange mechanism.
  • Development of user authentication for controlled server access.
  • Expansion of client functionalities, including group chat and file sharing capabilities.

Community Collaboration

We warmly invite the MIT App Inventor community to join us in refining and augmenting this chat application. Whether it's contributing code, suggesting features, or enhancing security, your participation is what will drive this project forward.

To get involved, please visit our GitHub collaboration page at https://github.com/iagolirapasssos/MITAppInventorchatServerClient/. Here, you can suggest improvements, report issues, or submit pull requests.

Together, we can craft a secure, feature-rich chat application that serves the diverse needs of the MIT App Inventor community. We're excited to see your contributions and to work collectively on this journey.

2 Likes

The ChatClient.aia on Github is built with Kodular components, so does not run on AI2.

Unlisting until sorted

Thanks for informing! I will do an AIA for MIT App Inventor

[Mod edit - the below method/aia does not work]

I created the AIA file based on Chat app message style - #51 by TIMAI2.

Go to GitHub - iagolirapasssos/MITAppInventorchatServerClient: This repository contains the implementation of a secure chat application with server-client architecture, where messages are encrypted and decrypted using symmetric cryptography. Below is a detailed description of how it works, how to use it, security considerations, and future improvements.

Thank you for the AI2 aia project.

I have done some testing, using Companion App on Android 13

Good of you to try my chat example, but it is not setup correctly to work. I reorganised things a bit but:

Client:

  • SendMessage does not work, no error message returned, nothing shown in server output ?
  • SendMessageWithDetails only sends/returns a uid, no IP or timestamp?
  • Decrypting an encrypted message requires me to split at comma the uid and the encrypted message in order to decrypt the message?

Server:

  • I note I have to recompile the server if I want to change the port number (doing this inside the code) - Is there a required range for the port number?
  • People will need to know that they have to provide "just" the IP address of their server location.
  • I assume that nothing is saved on the server, and all chat is lost if server is stopped?
  • is there a log for the server on the host machine ?

Other:

  • Can you please also provide an extension file (aix) for people to use
  • This topic should really be in Extensions, but perhaps we should work on things here until it is fixed.

Thanks for the observations! The project is still in its infancy and I will be happy with your help and that of other devs... Remember to configure the IP on the client with the same IP as the server is hosted.

Note: You must compile and run the server before starting the client. I tested the server on a virtual machine hosted on GalaxyGate with Ubuntu 22.

Thank you for uploading the aix.

Please see attached demo project

ChatServerExtnTest.aia (21.9 KB)

BLOCKS

As above, in my testing:

  • SendMessage does not work at all
  • SendMessageWithDetails does work but only sends a UID, no timestamp or IP is sent
  • SendMessageWithDetails when message encrypted, requires some text manipulation to return the message received

Do you see the same behaviour ?

Your ChatServer only seems to "serve" / "listen" on the localhost/local network? I tried loading it on my online server, opened the correct port with ufw, but no connection is made, nmap reports that the port is filtered (no-response), which indicates that nothing is listening on that port for external connections. I ran the ChatServer as root.

I tested it on an external server from the company GalaxyGate. sendMesage worked correctly. I'll see if I sent any wrong updates.

1 Like

I made the corrections and the client and server started working again.

Note: You need to get the new AIX file. The AIA files are all up to date.

And is the server code all OK ?

I downloaded the new ChatServer.java file as well, and compiled a new server, and updated with the new aix.

This all "works" now, returning just the message in all four cases, no details displayed in the message received for SendMessageWithDetails?

Here is the output from the server though:

Server listening on port 12345
Connection established with /192.168.1.157:37210
clientMethod: SendMessage, Message received: hello, IP: 192.168.1.157, ID: 3df985c3-db81-40f5-a7b7-8cffb36b8b3b, Timestamp: 2023-11-06 22:09:58
clientMethod: SendMessage, Message received: Lm7cLnXXIIQLQWNmsuSAVA==, IP: 192.168.1.157, ID: 3df985c3-db81-40f5-a7b7-8cffb36b8b3b, Timestamp: 2023-11-06 22:10:05
clientMethod: SendMessageWithDetails, Message received: hello, IP: 192.168.1.157, ID: 3df985c3-db81-40f5-a7b7-8cffb36b8b3b, Timestamp: 2023-11-06 22:10:20
clientMethod: SendMessageWithDetails, Message received: Lm7cLnXXIIQLQWNmsuSAVA==, IP: 192.168.1.157, ID: 3df985c3-db81-40f5-a7b7-8cffb36b8b3b, Timestamp: 2023-11-06 22:10:25

which shows that the "details" are being created for all four cases?

Still needs a bit of work at your end....

Again, how do I get the chat server working on a remote online server? Does it need an RSA key exchange ?

I formatted it like this:

  • SendMessage: Sends all information to the server, but the server only returns the message to the client.
  • SendMessageWithDetails: Sends all information to the server, but the server only returns the message and items to the client.

Note: We still need to add a key exchange service.

but no "items" (IP/timestamp/UID) are shown by the MessageReceived event, only the message sent....

Understood

Thanks! I will add!

until it works as promoted

Eventually got it to work as expected, after modifying the extension and the ChatServer.

Main Changes

  • Delimiter is changed from , to ;;, which should allow for commas in message text
  • SendMessage now sends: message, timestamp, ip, and uid
  • ChatMessageReceived provides the above four items on message return (to allow for decrypting of encrypted message) and options for the developer
  • SendMessageWithDetails is therefore no longer required
  • Revised extension built with RUSH
JAVA

ChatServer.java.txt (5.9 KB)
ChatClient.java.txt (9.0 KB)

EXTENSION

io.chatclientV3.aix (15.7 KB)

BLOCKS

AIA

ChatServerExtnTestV3.aia (19.5 KB)

Now what is needed is the ability to run the ChatServer on a remote server (online), otherwise all I can do with it is send messages to myself and my dog :wink: :dog2:

1 Like