Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify SimpleReactPyClient to not use pre-defined endpoints #1079

Open
Archmonger opened this issue Jun 30, 2023 · 1 comment
Open

Modify SimpleReactPyClient to not use pre-defined endpoints #1079

Archmonger opened this issue Jun 30, 2023 · 1 comment
Labels
priority-2-moderate Should be resolved on a reasonable timeline. type-refactor About improving code structure. type-revision About a change in functionality or behavior

Comments

@Archmonger
Copy link
Contributor

Archmonger commented Jun 30, 2023

Current Situation

We currently require a structured/implict routes for SimpleReactPyClient.

/*
 * - `_reactpy/stream/${route}${query}`: The websocket endpoint for the stream.
 * - `_reactpy/modules`: The directory containing the dynamically loaded modules.
 * - `_reactpy/assets`: The directory containing the static assets.
*/ 

Proposed Actions

Rewrite SimpleReactPyClient to allow the user to define their own routes. Will need a prop for each route.

Similar to reactpy-django, we need the following customization options:

  • mountId
    • The string ID of the mountable element
    • 504ef671-57a4-4128-a48d-3ec94c9bfd41
  • websocketUrl
    • Path to where the websocket is located at
    • reactpy/<dotted_path>
  • jsModulesUrl
    • Path to where we auto-serve JavaScript modules
    • reactpy/modules/
  • reconnectMax
    • When x many seconds pass, the websocket will give up retries
    • 3600
  • reconnectInterval
    • Client will retry to connect to the server every x seconds
    • 5

Note: We need to start treating the client JS file completely separately from other static files. The user needs can't ever configure their static file dir if we rely on it for core behavior.

@Archmonger Archmonger added flag-triage Not prioritized. priority-2-moderate Should be resolved on a reasonable timeline. type-revision About a change in functionality or behavior type-refactor About improving code structure. and removed flag-triage Not prioritized. labels Jun 30, 2023
@Archmonger
Copy link
Contributor Author

@rmorshea In order to plan for easy compatibility between template tags and ASGI middleware, I'd like us to remove the hacky URL routing workaround from reactpy/stream/. As we discussed, that's going to require use_messenger to get to that point.

The new websocket URL pattern should be reactpy/<component_dotted_path>/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority-2-moderate Should be resolved on a reasonable timeline. type-refactor About improving code structure. type-revision About a change in functionality or behavior
Projects
None yet
Development

No branches or pull requests

1 participant