Metadata-Version: 2.1
Name: socketio_pg_manager
Version: 0.0.4
Summary: Postgres client manager for python-socketio
Author-email: Chenyu Wang <wangchenyu2017@gmail.com>
Project-URL: Homepage, https://github.com/MonoidDev/socketio_pg_manager
Project-URL: Bug Tracker, https://github.com/MonoidDev/socketio_pg_manager/issues
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: python-socketio >=5.11.0
Requires-Dist: psycopg[binary] >=3.1.17

SocketIO PG Manager
===============

Postgres client manager for [python-socketio](https://python-socketio.readthedocs.io/).

# Install

```bash
python3 -m pip install socketio-pg-manager
```

# Usage

## Asynchronous Usage

When you are using `python-socketio` and you have multiple instances of your socketio server, simply pass `AsyncPgManager` to the constructor of `AsyncServer` 

```python
import socketio
import socketio_pg_manager

client_manager = socketio_pg_manager.AsyncPgManager(
    pg_options=dict(user="postgres", password="postgres")
)
sio = socketio.AsyncServer(async_mode="aiohttp", client_manager=client_manager)
```

For details, see [Using a Message Queue](https://python-socketio.readthedocs.io/en/stable/server.html#using-a-message-queue).

## Synchronous Usage

Not available now.

# How it works

`AsyncPgManager` is an implementation subtyping to `AsyncPubSubManager` of `python-socketio`. It creates a connection to your postgres database and listens on `LISTEN channel`, and publish any data using `NOTIFY channel, payload`.
