C# (CSharp) Bloom.Api Namespace

Classes

Name Description
ApiRequest When the Bloom UI makes an API call, a method that has been registered to handle that endpoint is called and given one of these. That method uses this class to get information on the request, and also to reply to the caller.
BloomServer
BloomWebSocketServer Runs a websocket on the given port. Useful for high-frequency messages (like audio levels) and allows the backend to send messages to the client. About ports... we could have a single server that is used to pass any number of messages. We could have a single connection on the client with a means to distribute messages around the client depending on, say, a message identifier. Or we could have multiple connections (sockets) from various parts in the client, each just filtering out the message stream to the ones they are interested in. Alternatively, you could have multiple instances of this class, each with its own "port" parameter, and intended for use by a single, simple end point. That is the case as this is introduced in Bloom 3.6, for getting the peak level of the audio coming from a microphone.
BookSettingsApi Exposes some settings of the current Book via API
BrandingApi Supports branding (e.g. logos) needed by projects
BrandingApi.Settings
CommandAvailabilityPublisher this is from spike, which worked, but we aren't using (yet). When searching for other parts of the spike, do a text search, as they may be commented out Commands have a status that needs to be communicated to the html client. This class does that by wiring up to events on commands and sending updated status on commands over a websocket.
CurrentBookHandler This class is responsible for handling Server requests that depend on knowledge of the current book. An exception is some reader tools requests, which have their own handler, though most of them depend on knowing the current book.
EndpointRegistration
EnhancedImageServer A local http server that can serve (low-res) images plus other files.
I18NHandler This class handles requests for internationalization. It uses the L10NSharp LocalizationManager to look up values.
PretendRequestInfo
RequestInfo this makes it easier to test without actually going through the http listener
ServerBase
SimulatedPageFile A SimulatedPageFile is used in connection with simulating a current-page file that needs to (seem to) be in the book folder so local hrefs work. We don't actually put files there (see EnhancedImageServer.MakeSimulatedPageFileInBookFolder for more), but rather store some data in the our file server object. The particular purpose of the SimulatedPageFile is to manage the lifetime for which the simulated page is kept in the server. It can be passed to the Browser which will Dispose() it when no longer needed. (In that regard, it is used in rather the same way as a TempFile object is used to make sure that a temp file gets deleted when the Browser no longer needs it.)
WebClientWithTimeout the base class waits for 30 seconds, which is too long for local thing like we are doing