Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/y-crdt/ypy-websocket
WebSocket Connector for Ypy
https://github.com/y-crdt/ypy-websocket
Last synced: 1 day ago
JSON representation
WebSocket Connector for Ypy
- Host: GitHub
- URL: https://github.com/y-crdt/ypy-websocket
- Owner: y-crdt
- License: mit
- Created: 2022-04-21T14:09:11.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-27T19:07:02.000Z (10 months ago)
- Last Synced: 2024-04-29T04:05:05.647Z (9 months ago)
- Language: Python
- Homepage: https://davidbrochart.github.io/ypy-websocket
- Size: 111 KB
- Stars: 34
- Watchers: 5
- Forks: 20
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Ypy-websocket
Ypy-websocket is an async WebSocket connector for [Ypy](https://github.com/y-crdt/ypy).
[![Build Status](https://github.com/y-crdt/ypy-websocket/workflows/CI/badge.svg)](https://github.com/y-crdt/ypy-websocket/actions)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)---
**Documentation**: https://davidbrochart.github.io/ypy-websocket
**Source Code**: https://github.com/y-crdt/ypy-websocket
---
Ypy-websocket is a Python library for building WebSocket servers and clients that connect and synchronize shared documents.
It can be used to create collaborative web applications.The following diagram illustrates a typical architecture. The goal is to share a document among several clients.
Each client has an instance of a [YDoc](https://ypy.readthedocs.io/en/latest/autoapi/y_py/index.html#y_py.YDoc), representing their view of a document. A shared document also lives in a [room](./reference/Room.md) on the server side. Conceptually, a room can be seen as the place where clients collaborate on a document. The WebSocket to which a client connects points to the corresponding room through the endpoint path. In the example below, clients A and B connect to a WebSocket at path `room-1`, and thus both clients find themselves in a room called `room-1`. All the `YDoc` synchronization logic is taken care of by the [WebsocketProvider](./reference/WebSocket_provider.md).
Each update to a shared document can be persisted to disk using a [store](./reference/Store.md), which can be a file or a database.
```mermaid
flowchart TD
classDef room1 fill:#f96
classDef room2 fill:#bbf
A[Client A
room-1]:::room1 <-->|WebSocket
Provider| server(WebSocket Server)
B[Client B
room-1]:::room1 <-->|WebSocket
Provider| server
C[Client C
room-2]:::room2 <-->|WebSocket
Provider| server
D[Client D
room-2]:::room2 <-->|WebSocket
Provider| server
server <--> room1((room-1
clients: A, B)):::room1
server <--> room2((room-2
clients: C, D)):::room2
A <-..-> room1
B <-..-> room1
C <-..-> room2
D <-..-> room2
room1 ---> store1[(Store)]
room2 ---> store2[(Store)]
```