Provide a mixin class to add authorization hooks to a request handler.
AuthMixin
This mixin adds the expected Tornado authorization hooks:
get_login_url
get_current_user
prepare
All of these delegate to the a AuthProvider confiured on the Bokeh tornado application.
AuthProvider
Delegate to the synchronous get_user method of the auth provider
get_user
Delegates to``get_login_url`` method of the auth provider, or the login_url attribute.
login_url
Async counterpart to get_current_user
Provide a request handler that returns a page displaying a document.
AutoloadJsHandler
Implements a custom Tornado handler for the autoload JS chunk
options
Browsers make OPTIONS requests under the hood before a GET request
set_default_headers
Override this to set HTTP headers at the beginning of the request.
For example, this is the place to set a custom Server header. Note that setting such headers in the normal flow of request processing may not do what you want, since headers may be reset during error handling.
Server
DocHandler
Implements a custom Tornado handler for document display page
Provide a request handler that returns a json with metadata information from the application
MetadataHandler
Provide a Request handler that lists the application (if more than one) or (if only one) redirects to the route of that applications.
RootHandler
Implements a custom Tornado handler to display the available applications If only one application it redirects to that application route
Abstract request handler that handles bokeh-session-id
SessionHandler
StaticHandler
Implements a custom Tornado static file handler for BokehJS JavaScript and CSS resources.
Provide a web socket handler for the Bokeh Server application.
WSHandler
Implements a custom Tornado WebSocketHandler for the Bokeh Server.
check_origin
Implement a check_origin policy for Tornado to call.
The supplied origin will be compared to the Bokeh server allowlist. If the origin is not allow, an error will be logged and False will be returned.
False
origin (str) – The URL of the connection origin
bool, True if the connection is allowed, False otherwise
get_compression_options
Override to return compression options for the connection.
If this method returns None (the default), compression will be disabled. If it returns a dict (even an empty one), it will be enabled. The contents of the dict may be used to control the following compression options:
compression_level specifies the compression level.
compression_level
mem_level specifies the amount of memory used for the internal compression state.
mem_level
These parameters are documented in details here: https://docs.python.org/3.6/library/zlib.html#zlib.compressobj
New in version 4.1.
Changed in version 4.5: Added compression_level and mem_level.
on_close
Clean up when the connection is closed.
on_message
Process an individual wire protocol fragment.
The websocket RFC specifies opcodes for distinguishing text frames from binary frames. Tornado passes us either a text or binary string depending on that opcode, we have to look at the type of the fragment to see what we got.
fragment (unicode or bytes) – wire fragment to process
on_pong
Invoked when the response to a ping frame is received.
open
Initialize a connection to a client.
None
select_subprotocol
Override to implement subprotocol negotiation.
subprotocols is a list of strings identifying the subprotocols proposed by the client. This method may be overridden to return one of those strings to select it, or None to not select a subprotocol.
subprotocols
Failure to select a subprotocol does not automatically abort the connection, although clients may close the connection if none of their proposed subprotocols was selected.
The list may be empty, in which case this method must return None. This method is always called exactly once even if no subprotocols were proposed so that the handler can be advised of this fact.
Changed in version 5.1: Previously, this method was called with a list containing an empty string instead of an empty list if no subprotocols were proposed by the client.
send_message
Send a Bokeh Server protocol message to the connected client.
message (Message) – a message to send
write_message
Override parent write_message with a version that acquires a write lock before writing.