bokeh.server.protocol_handler

Encapsulate handling of all Bokeh Protocol messages a Bokeh server may receive.

class ProtocolHandler[source]

A Bokeh server may be expected to receive any of the following protocol messages:

  • PATCH-DOC

  • PULL-DOC-REQ

  • PUSH-DOC

  • SERVER-INFO-REQ

The job of ProtocolHandler is to direct incoming messages to the right specialized handler for each message type. When the server receives a new message on a connection it will call handler with the message and the connection that the message arrived on. Most messages are ultimately handled by the ServerSession class, but some simpler messages types such as SERVER-INFO-REQ may be handled directly by ProtocolHandler.

Any unexpected messages will result in a ProtocolError.

async handle(message, connection)[source]

Delegate a received message to the appropriate handler.

Parameters
  • message (Message) – The message that was receive that needs to be handled

  • connection (ServerConnection) – The connection that received this message

Raises

ProtocolError