State Utility Methods
The state object has several methods and attributes that return information about the current page, session, or state.
Router Attributes
The self.router
attribute has several sub-attributes that provide various information:
router.page
: data about the current page and routehost
: The hostname and port serving the current page (frontend).path
: The path of the current page (for dynamic pages, this will contain the slug)raw_path
: The path of the page displayed in the browser (including params and dynamic values)full_path
:path
withhost
prefixedfull_raw_path
:raw_path
withhost
prefixedparams
: Dictionary of query params associated with the request
router.session
: data about the current sessionclient_token
: UUID associated with the current tab's token. Each tab has a unique token.session_id
: The ID associated with the client's websocket connection. Each tab has a unique session ID.client_ip
: The IP address of the client. Many users may share the same IP address.
router.headers
: a selection of common headers associated with the websocket connection. These values can only change when the websocket is re-established (for example, during page refresh). All other headers are available in the dictionaryself.router_data.headers
.host
: The hostname and port serving the websocket (backend).