connector: wanted(port) says whether anyone watches or reads a port

This commit is contained in:
Melvin Strobl
2026-10-27 15:20:24 +01:00
parent 7b453af3fe
commit 00cda9d2f1
4 changed files with 68 additions and 0 deletions
+14
View File
@@ -144,6 +144,20 @@ new frames arrive. Use durable storage for recordings.
Local screens receive pushed live frames; portal screens fetch the bytes.
Choose a modest poll rate for remote viewing.
`self.wanted(port)` says whether anyone wants what a port publishes right
now. That is a dashboard tile on screen, a portal screen, or a node of a
running flow reading its message. Check it before fetching a frame so a camera
sends nothing while nobody watches:
```python
async def poll(self):
if not self.wanted("frame"):
return None
...
```
On a remote worker it is always true, since the worker cannot see who watches.
## Keeping state across restarts
Keep connections and device handles in node attributes. Store short strings