Skip to content

Commit 881ff7f

Browse files
committed
Clarify WebSocket usage in docs
1 parent 8225b6a commit 881ff7f

4 files changed

Lines changed: 14 additions & 2 deletions

File tree

docs/app/content/docs/framework/realtime.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ order: 16
88

99
SPRAG's realtime layer connects server events to browser handlers over WebSockets. The design follows a simple principle: **signal then refetch**.
1010

11+
The built-in bridge uses the browser's native `WebSocket` API and SPRAG's server-side websocket endpoint. Socket.IO is not part of SPRAG's realtime runtime.
12+
1113
## Prerequisites
1214

1315
WebSocket server mode requires `gevent-websocket`. If you installed SPRAG with `pip install spragkit`, install it manually:

docs/app/content/docs/guides/deployment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ app = App(
114114
)
115115
```
116116

117-
This starts a Socket.IO server alongside the WSGI app. The browser loads the Socket.IO client automatically.
117+
This serves SPRAG's native websocket endpoint alongside the WSGI app. Browser Modules that use `on_socket(...)`, `emit_socket(...)`, `join_topic(...)`, or `refetch_on_socket(...)` connect through SPRAG's shared runtime bridge.
118118

119119
## Environment variables
120120

docs/app/content/docs/ragot/modules.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ For advanced ownership patterns, `adopt_component(...)` is also real on the unde
111111

112112
## Sockets
113113

114+
These methods use SPRAG's shared realtime bridge when the page runs in websocket mode. They do not require a Socket.IO client.
115+
114116
```python
115117
def on_start(self):
116118
# Listen for socket events

docs/app/content/docs/ragot/overview.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Under the hood, your compiled code uses:
1616
- **Keyed list reconciliation** (`renderList`) for `ui.For()` loops
1717
- **Grid layout engine** (`renderGrid`) for `ui.Grid()` layouts
1818
- **Lazy loading** (`createLazyLoader`) for `ui.LazyImage()` images
19-
- **Socket.IO client** for real-time communication
19+
- **Lifecycle-safe socket binding** for real-time clients supplied by SPRAG or your own browser code
2020
- **Animation helpers** (`animateIn`/`animateOut`) for CSS transitions
2121
- **Virtual scrolling** for large lists
2222

@@ -26,6 +26,14 @@ You don't interact with any of these directly. They're the compilation targets f
2626

2727
Occasionally you need a browser-only escape hatch. SPRAG exposes those through Python authoring stubs:
2828

29+
### Socket clients
30+
31+
Ragot does not bundle Socket.IO or open a socket connection on its own. Its socket helpers bind handlers to a client object and clean those handlers up with the Module lifecycle.
32+
33+
In normal SPRAG apps, `Module.on_socket(...)`, `Module.off_socket(...)`, `Module.emit_socket(...)`, and topics use SPRAG's shared realtime bridge. That bridge is documented in [Realtime](/docs/framework/realtime/) and uses the browser's native `WebSocket` API.
34+
35+
If you are writing browser-only Ragot code outside SPRAG's bridge, pass a client object with `on`, `off`, and `emit` methods to Ragot's socket helpers. A Socket.IO browser client can fit that shape, but it is an app-level dependency, not a Ragot or SPRAG runtime dependency.
36+
2937
### Module imports
3038

3139
Declare JS dependencies on the page manifest and use them in your Module:

0 commit comments

Comments
 (0)