Python port of Riptide, a light weight networking library.
This port provides functionality for establishing connections with clients and servers using the Riptide protocol.
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
- C#: Riptide
- Dart/Flutter: Riptide Dart Port
The API is mostly identical to Riptide.
Clone this repository and copy the folder "pytidenetworking" into your working directory.
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.
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)
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)
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.
- UDP (built-in)
- TCP (built-in)
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