PytideNetworking
Python port of Riptide
Install / Use
/learn @ebosseck/PytideNetworkingREADME
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
Related Skills
node-connect
341.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.5kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
341.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.5kCommit, push, and open a PR
