Python implementation of Riptide
Project description
Pytide
Python port of Riptide, a light weight networking library.
This port provides functionality for establishing connections with clients and servers using the Riptide protocol.
Compatibility
This port was last tested for functionality with Riptide Commit 5a86ca0, Jan 26 2023
This port is compatible with Riptide 2.1.0 to 2.2.0.
The Compatibility can be tested by connecting the C# client provided in the unity folder with the server implemented in testing/serverTCPTest.py or testing/serverUDPTest.py
Compatible libraries in other languages
- C#: Riptide
- Dart/Flutter: Riptide Dart Port
Getting Started
The API is mostly identical to Riptide.
Installation
From Source
Clone this repository and copy the folder "pytidenetworking" into your working directory.
Poetry
In your poetry project use
poetry add git+https://github.com/ebosseck/PytideNetworking.git
to add this project as an external dependency. This should already be sufficient to be able to use the PytideNetworking library in your poetry project.
Create a new Server
For an UDP server:
server: Server = Server()
server.start(PORT, 10)
For a TCP server:
tcpTransport = TCPServer()
server: Server = Server(tcpTransport)
server.start(PORT, 10)
In order to process the messages:
serverUpdater: FixedUpdateThread = FixedUpdateThread(server.update)
serverUpdater.start()
Handling received messages:
def handleMessage(clientID: int, message: Message):
pass # your code here
server.registerMessageHandler(messageID, handleMessage)
Create a new Client
For an UDP client:
client: Client = Client()
client.connect((SERVER_ADDRESS, PORT))
For a TCP client:
tcpTransport = TCPClient()
client: Client = Client(tcpTransport)
client.connect((SERVER_ADDRESS, PORT))
In order to process the messages:
clientUpdater: FixedUpdateThread = FixedUpdateThread(client.update)
clientUpdater.start()
Handling received messages:
def handleMessage(message: Message):
pass # your code here
client.registerMessageHandler(messageID, handleMessage)
Send Messages
msg = message.create(MessageSendMode.Unreliable, MESSAGE_ID_HANDLED)
msg.putString("Hello World !")
client.send(msg)
For more details, also check out the documentation of Riptide, as well as the samples in the testing folder.
Furthermore, a low level documentation of the protocol used is available in docs/ as pdf.
Low-Level Transports supported by Pytide
- UDP (built-in)
- TCP (built-in)
License
Distributed under the MIT license. See LICENSE.md for more information. Copyright © 2023 VISUS, University of Stuttgart
This project is supported by VISUS, University of Stuttgart
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 pytide_networking-2.1.0a0.tar.gz.
File metadata
- Download URL: pytide_networking-2.1.0a0.tar.gz
- Upload date:
- Size: 38.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4715e7cfcddd3fc65530f9e938a3c88c1c751a07952b308b2723532c419e1530
|
|
| MD5 |
a9497c77942f0fcd626a2a7c6090e47c
|
|
| BLAKE2b-256 |
db19ae1da1e16dd957e23d793f35609d00d122e983cbbc69edc6ac80b3b1a1a1
|
File details
Details for the file pytide_networking-2.1.0a0-py3-none-any.whl.
File metadata
- Download URL: pytide_networking-2.1.0a0-py3-none-any.whl
- Upload date:
- Size: 53.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb895d7f8ca30744e92259a74243039fdeb97abf78e97b2fe54d13644048c33f
|
|
| MD5 |
2db7fbc6ca0297400cc01ea1f9292742
|
|
| BLAKE2b-256 |
e412a52818f1eed60bc0eafca5a5b83e33ce58118cdddf2b8fa9bd86add4216e
|