An easy and secure Python library for real-time game chat
Project description
EasyGameChat
EasyGameChat is a minimal, secure, and cross-platform chat server and client library designed for real-time communication in games or applications. It aims to provide simple, fast integration across multiple languages with a JSON-based protocol and message validation system.
Features
- Lightweight and efficient server implementation in Go
- TLS encryption for secure communication
- Secure and strict input validation
- Modular server-client architecture
- Cross-language support (C++, Python, and more to come)
- JSON-based protocol for easy parsing
- Thread-safe and rate-limited message broadcasting
Getting Started
Server (Go)
- Install Go 1.18 or later.
- Generate a TLS certificte and key with the provided scripts or, preferably, use your own. The server requires a valid certificate and key for secure communication.
- Run the server:
go run main.go
TLS is enabled by default. You can configure certificate paths or disable TLS in the config file or server options.
Client (C++)
- Include
EasyGameChat.hin your project. - Install the required dependencies (only
nlohmann/jsonfor JSON parsing and a TLS library like OpenSSL) with your preferred package manager. On Windows, you can specify your preferred toolchain in the CMake build command with-DCMAKE_TOOLCHAIN_FILE=path/to/your/toolchain.cmake. - Compile and run the example:
cd examples/c-cpp
cmake -B build -S .
# If using vcpkg, specify the toolchain file:
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=C:\path\to\vcpkg\scripts\buildsystems\vcpkg.cmake
cmake --build build
./build/chat-client
Run the
/infocommand in the client to display connection details including TLS status.
Client (Python)
cd clients/python
python -m build
python -m pip install .\dist\easy_game_chat-0.3.0-py3-none-any.whl
# or install directly from the source
pip install .
python examples/python/main.py
Token Generation
To generate a token for authentication, use the following command:
go run main.go generate-token <username>
This will generate a token and store its hashed value securely in a tokens.json file. The token is valid for 24 hours and can be used for client authentication. Remember to save the token, as it will not be displayed again.
Protocol
Messages follow a simple JSON format:
{
"from": "nickname",
"text": "message content"
}
All input is sanitized and validated server-side to prevent injection, malformed data, or abuse.
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file easygamechat-0.3.0.tar.gz.
File metadata
- Download URL: easygamechat-0.3.0.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35153ed66b2dcde879fe62994c725726c494a06f04c3035adb329a8dc3f64ff7
|
|
| MD5 |
c76bd7363934f6c36a711c69faa2b5ac
|
|
| BLAKE2b-256 |
01631e7224419fda579d9e94c56940bc9e7d568b33d27065f7d79a509424d852
|
File details
Details for the file easygamechat-0.3.0-py3-none-any.whl.
File metadata
- Download URL: easygamechat-0.3.0-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35fdeaec1cd84328b07b981fdfa9d1c4b06fa66d5996760a32090f079a67446d
|
|
| MD5 |
b842ff147006365c62e4cb89df1b3365
|
|
| BLAKE2b-256 |
f9e00b6abef348df3ce5cabd2e1a29734bad5cdf3c8fc9b1036984fd497e093e
|