Allow server-side components to send messages to client-side components
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- javascript, python
- Domain
- full-stack
Research direction
Start with the callback registration in src/client/packages/@reactpy/client/src/reactpy-vdom.tsx and trace the existing client-to-server event path. The issue still needs an agreed interface for targets or channels before implementation. Done means server-side components can deliver messages to the intended custom client-side component and the contract is documented and tested.
Written by the indexing model from the issue text.
Description
Current Situation
Presently, custom client-side components are able to send events back to the server. However, it is not possible to send events from server-side components to client-side ones.
Proposed Actions
Now that custom JS components have the ability to register callbacks with the client this should be technologically feasible. With that said, while users can listen in on particular message types, there is no concept of a message "target". We could achieve this by having message types of the form server-event:<the-target>, but this seems like a bit of a hack. Perhaps we can allow (require?) a nullable target field for this purpose.
Before diving into all those details though, we need to work out exactly what this interface should look like.
I can imagine having an interface similar to:
@component
def example():
channel = use_channel()
@use_effect
async def delayed_message():
import asyncio
await asyncio.sleep(5)
await channel.send({"my": "message"})
response = await channel.receive()
return custom_js_component({"channel_id": channel.id})
where custom_js_component would then subscribe to messages of the type channel-message and target channel.id.
- Dominant language
- Python
- Stars
- 8.1k
- Forks
- 332
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from reactive-python/reactpy
-
Outdated GIF in Docs Openpriority-3-low type-docs
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
reactive-python/reactpy#1034 ·
-
priority-2-moderate type-revision
Difficulty 5/5 Over a week Newbie friendliness 25/100
reactive-python/reactpy#1319 ·
-
priority-1-high
Difficulty 5/5 Over a week Newbie friendliness 25/100
reactive-python/reactpy#1277 ·
-
priority-3-low
Difficulty 5/5 Over a week Newbie friendliness 35/100
reactive-python/reactpy#1273 · 1 reaction ·
-
priority-2-moderate
Difficulty 5/5 Over a week Newbie friendliness 30/100
reactive-python/reactpy#1272 · 2 reactions ·
All issues in reactive-python/reactpy
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100