Enable accessing websocket instance in generator-style pages
Could you please provide access to websocket instance in generator-style pages? Because on_page_ready handler has websocket optional argument, whereas generator-style page can't access websocket after the page is ready (after yield).
By the way, a bigger picture: this is needed to redirect user to a login page when he's not authenticated. I execute await ui.run_javascript('window.location.replace("/login")', respond=False) in the page ready handler. The usual way to do it would be to return RedirectResponse, but page build functions do not allow this. It's not a major issue, we could perform a redirect using Javascript, but I don't know whether you like it or not. If not, then probably you could allow to return Response objects from page build functions. Or allow to supply a subclass of Page class to ui.page decorator - then I could override Page._route_function in subclass.
But so far running Javascript to redirect is fine for me - the job is done.