目录

Ypy-websocket

Ypy-websocket is an async WebSocket connector for Ypy.

Build Status Code style: 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, representing their view of a document. A shared document also lives in a room 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.

Each update to a shared document can be persisted to disk using a store, which can be a file or a database.

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)]
关于

为Yjs协作编辑框架提供WebSocket服务器和客户端实现,支持实时协同编辑

890.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802032778号