Ascender LiveAPI Protocol - for live API communication.
Project description
Ascender LiveAPI Protocol (ALP)
Ascender LiveAPI Protocol (ALP) is a structured, Socket.IO-based event system for real-time communication between clients and backend services. It is simple and easy-to-use implementation of SocketIO into Ascender Framework with framework's architecture and DI support.
Getting Started
Prerequisites
Ensure you have the following dependencies installed:
- Python 3.11 or higher
- Ascender Framework 2.0 or higher
- Poetry (for dependency management)
- pip (Python's package manager)
Installation
-
Initiate Ascender Framework Project (if not already):
ascender new --name example-alp ... cd example-alp
-
Add ALP as a package to the project:
poetry add ascender-alp
-
Add provider in bootstrap: In
src/bootstrap.pyadd# src/bootstrap.py from alp import provideALP from ascender.core.types import IBootstrap appBootstrap: IBootstrap = { "providers": [ provideALP() ] }
-
Add an ALPReceiver in your controller: To handle incoming events/messages, use decorator
@ALPReceiverin your controller.from alp import ALPReceiver @Controller( standalone=True, ) class ChatGateway: @ALPReceiver("connect", namespace="/chats") async def handle_connect(self, sid: str): print(f"[ALP] Client connected: {sid}") @ALPReceiver("chat-toggle", namespace="/chats") async def toggle_chat(self, sid: str, data: UUID): print(f"[ALP] Chat toggled: {data}") return {"status": "ok"}
-
Emit event / Send message via Transmitter: If you need to send message or emit any event, you can use ALP's
TransmitterModuleandTransmitterobject. To useTransmitterobject, you should importTransmitterModulein yourAscModuleorControllerif one is standalone specifying namespace if required.from alp import TransmitterModule, ALPReceiver, Transmitter from ascender.common import BaseDTO class MessageDTO(BaseDTO): sender_id: str message: str @Controller( standalone=True, imports=[ TransmitterModule.with_namespace("/chats") ] ) class ChatGateway: def __init__(self, transmitter: Transmitter): self.transmitter = transmitter @ALPReceiver("connect", namespace="/chats") async def handle_connect(self, sid: str): await self.transmitter.emit("message", MessageDTO(sender_id=sid, message=f"User {sid} joined the chat."), room="cool_convo", namespace="/chat") await self.transmitter.enter_room(sid, "cool_convo", namespace="/chat") print(f"[ALP] Client connected: {sid}") @ALPReceiver("message", namespace="/chats") async def handle_message(self, sid: str, data: MessageDTO): await self.transmitter.emit("message", data, room="cool_convo", namespace="/chat") return {"status": "ok"}
If everything works, you're done!
Roadmap
- Typescript ALP Client
- CLI generator for ALP based controllers
- Built-in reconnection helpers
- Websocket testing utils
- Native websocket support
- Additional transportation protocols support
License
MIT © 2025 Ascender Projects
Get Involved
Have feedback? Submit issues, PRs, or ideas - let’s make real-time Ascender-native and beautiful. Don’t forget to star ⭐ the repo if you like it.
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 ascender_alp-0.0.2.tar.gz.
File metadata
- Download URL: ascender_alp-0.0.2.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.11.13 Linux/6.14.8-asahi-1-1-ARCH
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec14ddde72178217ae91d658d2f2b1c2ada7c65eb447fbb274dae43982e28ebb
|
|
| MD5 |
2b84fa385e363788d420968b96f5a80d
|
|
| BLAKE2b-256 |
c95561847335e78029d2c0b788fadb6ed82dee4aedf7fa1b9b2bee25b39e38a3
|
File details
Details for the file ascender_alp-0.0.2-py3-none-any.whl.
File metadata
- Download URL: ascender_alp-0.0.2-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.11.13 Linux/6.14.8-asahi-1-1-ARCH
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
358120ecc2256a0d1bf0f5ee7bdbfa477684684b719ac164fe030acc164f53ad
|
|
| MD5 |
e2642706e01cdae4d7c91cdb26cc0f89
|
|
| BLAKE2b-256 |
9f3ca7fde18ec6fa8eb25629ff468c59f974b6121f20c08f546150dc15118f47
|