You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add real-time collaboration features to the editor using **[WebSocket API](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API)** and *[operational transforms](https://en.wikipedia.org/wiki/Operational_transformation)*.
62
62
63
-
### Architecture
64
-
65
-
\`\`\`mermaid
66
-
flowchart LR
67
-
subgraph Client["Client Browser"]
68
-
UI[React UI] --> OT[OT Engine]
69
-
OT <--> WS[WebSocket Client]
70
-
end
71
-
72
-
subgraph Server["Backend"]
73
-
WSS[WebSocket Server] <--> OTS[OT Transform]
74
-
OTS <--> DB[(PostgreSQL)]
75
-
end
76
-
77
-
WS <--> WSS
78
-
\`\`\`
79
-
80
-
### Service Dependencies (Graphviz)
81
-
82
-
\`\`\`graphviz
83
-
digraph CollaborationStack {
84
-
rankdir=LR;
85
-
node [shape=box, style="rounded"];
86
-
87
-
Browser [label="Client Browser"];
88
-
API [label="WebSocket API"];
89
-
OT [label="OT Engine"];
90
-
Redis [label="Presence Cache"];
91
-
Postgres [label="PostgreSQL"];
92
-
93
-
Browser -> API;
94
-
API -> OT;
95
-
OT -> Redis;
96
-
OT -> Postgres;
97
-
}
98
-
\`\`\`
99
-
100
63
## Phase 1: Infrastructure
101
64
102
65
### WebSocket Server
@@ -152,6 +115,43 @@ CREATE TABLE collaborators (
152
115
CREATE INDEX idx_collaborators_document ON collaborators(document_id);
153
116
\`\`\`
154
117
118
+
### Architecture
119
+
120
+
\`\`\`mermaid
121
+
flowchart LR
122
+
subgraph Client["Client Browser"]
123
+
UI[React UI] --> OT[OT Engine]
124
+
OT <--> WS[WebSocket Client]
125
+
end
126
+
127
+
subgraph Server["Backend"]
128
+
WSS[WebSocket Server] <--> OTS[OT Transform]
129
+
OTS <--> DB[(PostgreSQL)]
130
+
end
131
+
132
+
WS <--> WSS
133
+
\`\`\`
134
+
135
+
### Service Dependencies (Graphviz)
136
+
137
+
\`\`\`graphviz
138
+
digraph CollaborationStack {
139
+
rankdir=LR;
140
+
node [shape=box, style="rounded"];
141
+
142
+
Browser [label="Client Browser"];
143
+
API [label="WebSocket API"];
144
+
OT [label="OT Engine"];
145
+
Redis [label="Presence Cache"];
146
+
Postgres [label="PostgreSQL"];
147
+
148
+
Browser -> API;
149
+
API -> OT;
150
+
OT -> Redis;
151
+
OT -> Postgres;
152
+
}
153
+
\`\`\`
154
+
155
155
## Phase 2: Operational Transforms
156
156
157
157
> The key insight is that we need to transform operations against concurrent operations to maintain consistency.
0 commit comments