EWSLite Web Server API
The EWSLite library (located in the target/mcoewslite directory) is a compact embedded HTTP server written in C. It is designed for building RESTful APIs in resource-constrained environments and provides basic support for HTTP methods, request routing, JSON response generation, and WebSocket communication. Configuration is performed at compile time through macro definitions, which allows functionality to be precisely tailored to the needs of a specific application while keeping overhead minimal.
Within eXtremeDB/rt, EWSLite is used to implement the monitoring module, located in the target/mcorestrt directory. This module exposes internal database runtime statistics through a REST API, enabling applications to query metrics such as memory usage, transaction activity, I/O operation counts, and other performance indicators. Responses are generated in structured JSON format, making them easy to consume by external monitoring tools, dashboards, or custom applications. By relying on EWSLite, the monitoring module delivers real-time visibility into database operations with minimal overhead, while remaining fully portable across platforms supported by eXtremeDB/rt.
API Function Index
Macros and Structures
Macros and structures used in the EWSLite API.Description of the connection context structure.Description of HTTP request handler function type.HTTP Server Lifecycle Management
Initializes the EWSLite HTTP server with the specified parameters.Closes EWSLite HTTP server sockets and releases associated resources.Starts the EWSLite HTTP server listening loop.Sends a stop signal to the EWSLite HTTP server.Checks whether the EWSLite HTTP server has been stopped.Starts listening for incoming HTTP connections.Checks for new incoming HTTP connections and handles them.Request/Response Buffer I/O
Appends the end-of-headers marker to the response buffer.Appends an HTTP header to the response buffer.Appends an integer value to the response buffer.Appends a string to the response buffer.Appends a 64-bit unsigned integer to the response buffer.Flushes the response buffer.Sends a standard HTTP error response to the client.Checks whether the buffer contents start with a given null-terminated string.Checks whether the buffer contents start with a given null-terminated string (case-insensitive).Compares a null-terminated string against the buffer contents.Compares a null-terminated string against the buffer contents (case-insensitive).Retrieves the value of a specified HTTP header from the request.Retrieves the value of a specified query parameter from the request buffer.Retrieves the integer value of a specified query parameter from the request buffer.Encodes binary data in Base64.Decodes a URL-encoded string.Checks whether the current request method matches a specified method.Checks whether the current request URL matches a specified URL.WebSocket Protocol Handling
Checks whether the current request is a WebSocket upgrade request.Generates a WebSocket handshake response.Checks whether the current frame is a WebSocket close frame.Sends a WebSocket closing frame to the client.Sends a WebSocket data frame to the client.JSON Response Serialization
Initializes a JSON serialization context.Finalizes a JSON serialization context.Opens a JSON array in the serialization context.Opens a JSON object in the serialization context.Opens a nested JSON object within a JSON object.Opens a JSON array within a JSON object.Closes a JSON object or array in the serialization context.Adds an integer value to a JSON array.Adds a string value to a JSON array.Adds an unsigned 64-bit integer value to a JSON array.Adds an integer value to a JSON object.Adds a string value to a JSON object.Adds an unsigned 64-bit integer value to a JSON object.