# Pytide
Python port of [Riptide](https://github.com/RiptideNetworking/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](https://github.com/RiptideNetworking/Riptide/tree/5a86ca0a67d6cce1fb080eaca0535d030528f0d6), 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](https://github.com/RiptideNetworking/Riptide)
- Dart/Flutter: [Riptide Dart Port](https://github.com/JayKay135/Riptide-Dart-Port)
## Getting Started
The API is mostly identical to [Riptide](https://github.com/RiptideNetworking/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:
```python
server: Server = Server()
server.start(PORT, 10)
```
For a TCP server:
```python
tcpTransport = TCPServer()
server: Server = Server(tcpTransport)
server.start(PORT, 10)
```
In order to process the messages:
```python
serverUpdater: FixedUpdateThread = FixedUpdateThread(server.update)
serverUpdater.start()
```
Handling received messages:
```python
def handleMessage(clientID: int, message: Message):
pass # your code here
server.registerMessageHandler(messageID, handleMessage)
```
### Create a new Client
For an UDP client:
```python
client: Client = Client()
client.connect((SERVER_ADDRESS, PORT))
```
For a TCP client:
```python
tcpTransport = TCPClient()
client: Client = Client(tcpTransport)
client.connect((SERVER_ADDRESS, PORT))
```
In order to process the messages:
```python
clientUpdater: FixedUpdateThread = FixedUpdateThread(client.update)
clientUpdater.start()
```
Handling received messages:
```python
def handleMessage(message: Message):
pass # your code here
client.registerMessageHandler(messageID, handleMessage)
```
### Send Messages
```python
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](https://www.visus.uni-stuttgart.de/en/), [University of Stuttgart](https://www.uni-stuttgart.de/)
This project is supported by [VISUS](https://www.visus.uni-stuttgart.de/en/), University of Stuttgart
Raw data
{
"_id": null,
"home_page": null,
"name": "pytide-networking",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "PytideNetworking, networking, Riptide",
"author": null,
"author_email": "ebosseck <pypi-packages@mail-b.org>",
"download_url": "https://files.pythonhosted.org/packages/db/19/ae1da1e16dd957e23d793f35609d00d122e983cbbc69edc6ac80b3b1a1a1/pytide_networking-2.1.0a0.tar.gz",
"platform": null,
"description": "# Pytide\r\n\r\nPython port of [Riptide](https://github.com/RiptideNetworking/Riptide), a light weight networking library.\r\n\r\nThis port provides functionality for establishing connections with clients and servers using the Riptide protocol. \r\n\r\n## Compatibility\r\n\r\nThis port was last tested for functionality with Riptide [Commit 5a86ca0](https://github.com/RiptideNetworking/Riptide/tree/5a86ca0a67d6cce1fb080eaca0535d030528f0d6), Jan 26 2023\r\n\r\nThis port is compatible with Riptide 2.1.0 to 2.2.0.\r\n\r\nThe 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\r\n\r\n## Compatible libraries in other languages\r\n\r\n- C#: [Riptide](https://github.com/RiptideNetworking/Riptide)\r\n- Dart/Flutter: [Riptide Dart Port](https://github.com/JayKay135/Riptide-Dart-Port)\r\n\r\n## Getting Started\r\n\r\nThe API is mostly identical to [Riptide](https://github.com/RiptideNetworking/Riptide).\r\n\r\n### Installation\r\n\r\n#### From Source\r\n\r\nClone this repository and copy the folder \"pytidenetworking\" into your working directory.\r\n\r\n#### Poetry\r\n\r\nIn your poetry project use\r\n\r\npoetry add git+https://github.com/ebosseck/PytideNetworking.git\r\n\r\nto add this project as an external dependency.\r\nThis should already be sufficient to be able to use the PytideNetworking library in your poetry project.\r\n\r\n### Create a new Server\r\n\r\nFor an UDP server:\r\n```python\r\n server: Server = Server()\r\n server.start(PORT, 10)\r\n```\r\n\r\nFor a TCP server:\r\n\r\n```python\r\n tcpTransport = TCPServer()\r\n server: Server = Server(tcpTransport)\r\n server.start(PORT, 10)\r\n```\r\n\r\nIn order to process the messages:\r\n\r\n```python\r\n serverUpdater: FixedUpdateThread = FixedUpdateThread(server.update)\r\n serverUpdater.start()\r\n```\r\n\r\nHandling received messages:\r\n\r\n```python\r\ndef handleMessage(clientID: int, message: Message):\r\n pass # your code here\r\n \r\nserver.registerMessageHandler(messageID, handleMessage)\r\n```\r\n\r\n### Create a new Client\r\n\r\nFor an UDP client:\r\n```python\r\n client: Client = Client()\r\n client.connect((SERVER_ADDRESS, PORT))\r\n```\r\n\r\nFor a TCP client:\r\n```python\r\n tcpTransport = TCPClient()\r\n client: Client = Client(tcpTransport)\r\n client.connect((SERVER_ADDRESS, PORT))\r\n```\r\n\r\nIn order to process the messages:\r\n\r\n```python\r\n clientUpdater: FixedUpdateThread = FixedUpdateThread(client.update)\r\n clientUpdater.start()\r\n```\r\n\r\nHandling received messages:\r\n\r\n```python\r\ndef handleMessage(message: Message):\r\n pass # your code here\r\n \r\nclient.registerMessageHandler(messageID, handleMessage)\r\n```\r\n\r\n### Send Messages\r\n\r\n```python\r\n msg = message.create(MessageSendMode.Unreliable, MESSAGE_ID_HANDLED)\r\n msg.putString(\"Hello World !\")\r\n client.send(msg)\r\n```\r\n\r\nFor more details, also check out the documentation of Riptide, as well as the samples in the testing folder.\r\n\r\nFurthermore, a low level documentation of the protocol used is available in docs/ as pdf.\r\n\r\n## Low-Level Transports supported by Pytide\r\n\r\n* UDP (built-in)\r\n* TCP (built-in)\r\n\r\n## License\r\n\r\nDistributed under the MIT license. See LICENSE.md for more information. Copyright \u00a9 2023 [VISUS](https://www.visus.uni-stuttgart.de/en/), [University of Stuttgart](https://www.uni-stuttgart.de/)\r\n\r\nThis project is supported by [VISUS](https://www.visus.uni-stuttgart.de/en/), University of Stuttgart\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Python implementation of Riptide",
"version": "2.1.0a0",
"project_urls": {
"homepage": "https://github.com/ebosseck/PytideNetworking",
"repository": "https://github.com/ebosseck/PytideNetworking"
},
"split_keywords": [
"pytidenetworking",
" networking",
" riptide"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e412a52818f1eed60bc0eafca5a5b83e33ce58118cdddf2b8fa9bd86add4216e",
"md5": "2db7fbc6ca0297400cc01ea1f9292742",
"sha256": "cb895d7f8ca30744e92259a74243039fdeb97abf78e97b2fe54d13644048c33f"
},
"downloads": -1,
"filename": "pytide_networking-2.1.0a0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2db7fbc6ca0297400cc01ea1f9292742",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 53866,
"upload_time": "2024-05-02T20:56:23",
"upload_time_iso_8601": "2024-05-02T20:56:23.833521Z",
"url": "https://files.pythonhosted.org/packages/e4/12/a52818f1eed60bc0eafca5a5b83e33ce58118cdddf2b8fa9bd86add4216e/pytide_networking-2.1.0a0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "db19ae1da1e16dd957e23d793f35609d00d122e983cbbc69edc6ac80b3b1a1a1",
"md5": "a9497c77942f0fcd626a2a7c6090e47c",
"sha256": "4715e7cfcddd3fc65530f9e938a3c88c1c751a07952b308b2723532c419e1530"
},
"downloads": -1,
"filename": "pytide_networking-2.1.0a0.tar.gz",
"has_sig": false,
"md5_digest": "a9497c77942f0fcd626a2a7c6090e47c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 38592,
"upload_time": "2024-05-02T20:56:26",
"upload_time_iso_8601": "2024-05-02T20:56:26.172854Z",
"url": "https://files.pythonhosted.org/packages/db/19/ae1da1e16dd957e23d793f35609d00d122e983cbbc69edc6ac80b3b1a1a1/pytide_networking-2.1.0a0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-02 20:56:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ebosseck",
"github_project": "PytideNetworking",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pytide-networking"
}