connector: wanted(port) says whether anyone watches or reads a port
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user