Hi there,
By way of context, I run my app using bokeh serve app_dir and what I’m trying to do is
- add a drop down to a Bokeh app that can be used to select one of a number of themes
- have the user selection remembered using a cookie for the next time they visit the web page
I’ve managed to achieve 1. using a Select object with a callback, and part of 2. by setting a cookie on the webpage with a CustomJS callback e.g. document.cookie = "theme=dark";
What I’m struggling with though is viewing the cookie from the HTTP request the next time the user visits the page. If I call
request = curdoc().session_context.request
then I get a _RequestProxy object which only has a copy of the query parameters as arguments on it, it doesn’t have a copy of the cookies that were on the request.
I can patch Bokeh and the _RequestProxy object to also contain a copy of the cookies but before I do that I’d like to know
- Is there an official, supported way of getting access to the request cookies?
- Is there an alternative mechanism to do what I want? I’d like to avoid saving the preference server side as then it would need to be communicated between server instances.
- If no to both of the above, are there any downsides of taking a copy of the request cookies and putting them on the _RequestProxy object?
Many thanks
Alan


