Skip to content

Commit a936c66

Browse files
committed
Plan ahead for new websocket URL pattern
1 parent fa34c31 commit a936c66

File tree

1 file changed

+4
-4
lines changed
  • src/py/reactpy/reactpy/backend

1 file changed

+4
-4
lines changed

src/py/reactpy/reactpy/backend/asgi.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def __init__(
3535
self,
3636
app_or_component: ComponentConstructor | Coroutine,
3737
*,
38-
dispatcher_path: str = "^reactpy/stream/([^/]+)/?",
38+
dispatcher_path: str = "^reactpy/([^/]+)/?",
3939
js_modules_path: str | None = "^reactpy/modules/([^/]+)/?",
4040
static_path: str | None = "^reactpy/static/([^/]+)/?",
4141
static_dir: str | None = DEFAULT_STATIC_PATH,
@@ -117,9 +117,9 @@ async def component_dispatch_app(self, scope, receive, send) -> None:
117117
self._reactpy_recv_queue: asyncio.Queue = asyncio.Queue()
118118
parsed_url = urllib.parse.urlparse(scope["path"])
119119

120-
# TODO: Get the component via URL attached to template tag
121-
parsed_url_query = urllib.parse.parse_qs(parsed_url.query)
122-
component = lambda _: None
120+
# If in standalone mode, serve the user provided component.
121+
# In middleware mode, get the component from the URL.
122+
component = self.component or re.match(self.dispatch_path, scope["path"])[1]
123123

124124
while True:
125125
event = await receive()

0 commit comments

Comments
 (0)