# EWSLite macros and structures

## Macros

- LEWS_INCOMING_CONNECTION_BUF_SIZE
- LEWS_OUTGOING_CONNECTION_BUF_SIZE
- MCOEWSLITE_USE_STATIC_BUFFERS
- LEWS_MAX_CONNECTION_THREADS
- MCOEWSLITE_USE_THREADS

## Structures

- lews_connection_context_t - struct encapsulates the context associated with a web server connection
- lews_JSON_context_t - struct encapsulates the state required for incremental JSON serialization

### LEWS_INCOMING_CONNECTION_BUF_SIZE

> The `LEWS_INCOMING_CONNECTION_BUF_SIZE` macro defines the size of the EWSLite Web Server buffer for receiving HTTP requests.

> The default value is 4096.

### LEWS_OUTGOING_CONNECTION_BUF_SIZE

> The `LEWS_OUTGOING_CONNECTION_BUF_SIZE` macro defines the size of the EWSLite Web Server buffer for preparing HTTP responses.

> The default value is 4096.

### MCOEWSLITE_USE_STATIC_BUFFERS

> When the `MCOEWSLITE_USE_STATIC_BUFFERS` macro is defined, EWSLite utilizes two globally defined static buffers for receiving requests and preparing responses. The sizes of these buffers are determined by the `LEWS_INCOMING_CONNECTION_BUF_SIZE` and `LEWS_OUTGOING_CONNECTION_BUF_SIZE` constants, respectively.

> Conversely, when this macro is not defined, the buffers are allocated within the context of each individual connection.

> By default, the `MCOEWSLITE_USE_STATIC_BUFFERS` macro is not defined. Use static buffers only in single-threaded mode.

### LEWS_MAX_CONNECTION_THREADS

> The `LEWS_MAX_CONNECTION_THREADS` macro defines the number of threads in the connection handling thread pool. The total number of server threads is `LEWS_MAX_CONNECTION_THREADS + 1`.

> The default value is 6.

### MCOEWSLITE_USE_THREADS

> The `MCOEWSLITE_USE_THREADS` macro definition allows using the thread pool for HTTP connection handling. Also, it makes WebSocket functions available. The size of the thread pool is defined by `LEWS_MAX_CONNECTION_THREADS`.

> The `MCOEWSLITE_USE_THREADS` macro is defined by default in mcoewslite.h.