Metadata-Version: 2.1
Name: cloudlink
Version: 0.2.0.1
Summary: A powerful WebSocket extension for Scratch.
Author-email: MikeDev101 <mike@meower.org>
License: MIT License
        
        Copyright 2023 Mike J. Renaker / "MikeDEV".
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Project-URL: Source Code, https://github.com/MikeDev101/cloudlink
Classifier: Programming Language :: Python :: 3.11
Classifier: Operating System :: OS Independent
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: snowflake-id>=0.0.2
Requires-Dist: cerberus>=1.3.4
Requires-Dist: websockets>=10.4
Requires-Dist: ujson>=5.7.0

# CloudLink Python
This is the original, Python-based codebase for CloudLink server.

## 💡 Features 💡

### 🪶 Fast and lightweight
CloudLink can run on minimal resources. At least 25MB of RAM and any reasonably capable CPU can run a CloudLink server.

### 🌐 Essential networking tools
* Unicast and multicast packets across clients
* Expandable functionality with a built-in method loader

### 📦 Minimal dependencies
All dependencies below can be installed using `pip install -r requirements.txt`.
* 🐍 Python >=3.11
* 🧵 asyncio (Built-in)
* 📃 ["ujson" ultrajson](https://github.com/ultrajson/ultrajson)
* 🔍 [pyeve/cerberus](https://github.com/pyeve/cerberus)
* ❄️ ["snowflake-id" vd2org/snowflake](https://github.com/vd2org/snowflake)
* 🌐 [aaugustin/websockets](https://github.com/aaugustin/websockets)

### 🔋Batteries included
The CloudLink Python server comes with full support for the CL4 protocol and the Scratch cloud variable protocol.
Just download, setup, and start!

### 🧱 Plug-and-play modularity
You can easily extend the functionality of the server using classes and decorators. 
Here's an example of a simple plugin that displays "Foobar!" in the console
when a client sends the message `{ "cmd": "foo" }` to the server.

```python
# Import the server
from cloudlink import server

# Import default protocol
from cloudlink.server.protocols import clpv4

# Instantiate the server object
server = server()

# Set logging level
server.logging.basicConfig(
    level=server.logging.DEBUG
)

# Load default CL protocol
clpv4 = clpv4(server)

# Define the functions your plugin executes
class myplugin:
    def __init__(self, server, protocol):
        
        # Example command - client sends { "cmd": "foo" } to the server, this function will execute
        @server.on_command(cmd="foo", schema=protocol.schema)
        async def foobar(client, message):
            print("Foobar!")

# Load the plugin!
myplugin(server, clpv4)

# Start the server!
server.run()
```
