# microsoft/cpprestsdk architecture

> Architecture diagram of the GitHub repository microsoft/cpprestsdk, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/microsoft/cpprestsdk
- Repository: https://github.com/microsoft/cpprestsdk

## Overview

The archived C++ REST SDK is a native C++ library for asynchronous cloud client/server communication. Its principal user workflow is to construct an HTTP client, send a request, and receive an asynchronous response; the repository also provides server listening, WebSocket client, OAuth, JSON, URI, stream, and task capabilities. The graph preserves those documented product areas. Some implementation links are dashed because the available excerpts and source index show references, not the runtime calls that would verify control flow.

Main entry points: [`Release/include/cpprest/http_client.h`](https://github.com/microsoft/cpprestsdk/blob/master/Release/include/cpprest/http_client.h) (HTTP client API), [`Release/src/http/client/http_client.cpp`](https://github.com/microsoft/cpprestsdk/blob/master/Release/src/http/client/http_client.cpp) (Client orchestration), [`Release/include/cpprest/http_msg.h`](https://github.com/microsoft/cpprestsdk/blob/master/Release/include/cpprest/http_msg.h) (HTTP messages), [`Release/src/http/listener/http_listener.cpp`](https://github.com/microsoft/cpprestsdk/blob/master/Release/src/http/listener/http_listener.cpp) (HTTP listener)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP communication"]
  node_httpclient["HTTP client API<br/>[http_client.h]"]
  node_clientcore["Client orchestration<br/>[http_client.cpp]"]
  node_clienttransport["Client transport"]
  node_httpmessage["HTTP messages<br/>[http_msg.h]"]
  node_listener["HTTP listener<br/>[http_listener.cpp]"]
  node_servertransport["Server transport"]
  node_oauth["OAuth flows<br/>[oauth2.cpp]"]
end

subgraph group_realtime["WebSocket client"]
  node_websocket["WebSocket API<br/>[ws_client.h]"]
  node_wsruntime["WebSocket runtime<br/>[ws_client.cpp]"]
  node_wsmessage["WebSocket messages<br/>[ws_msg.cpp]"]
end

subgraph group_data["Data and streams"]
  node_json["JSON parsing<br/>[json_parsing.cpp]"]
  node_jsonserialization["JSON serialization"]
  node_uri["URI handling<br/>[uri.cpp]"]
  node_streams["Async streams<br/>[streams.h]"]
  node_fileio["File streams<br/>[fileio_posix.cpp]"]
end

subgraph group_async["Async foundation"]
  node_tasks["PPL tasks<br/>[pplxtasks.h]"]
  node_threadpool["Thread pool<br/>[threadpool.cpp]"]
end

node_developer(("SDK user"))

node_developer -->|"sends requests"| node_httpclient
node_developer -.->|"serves requests"| node_listener
node_developer -.->|"opens connection"| node_websocket
node_httpclient -.->|"delegates"| node_clientcore
node_clientcore -.->|"dispatches"| node_clienttransport
node_clientcore -.->|"handles messages"| node_httpmessage
node_listener -.->|"uses transport"| node_servertransport
node_httpclient -.->|"supports OAuth"| node_oauth
node_websocket -.->|"delegates"| node_wsruntime
node_wsruntime -.->|"handles messages"| node_wsmessage
node_httpmessage -.->|"supports JSON"| node_json
node_httpmessage -.->|"uses streams"| node_streams
node_httpclient -.->|"uses URI"| node_uri
node_fileio -.->|"provides streams"| node_streams
node_clientcore -.->|"completes tasks"| node_tasks
node_threadpool -.->|"supports execution"| node_tasks

click node_httpclient "https://github.com/microsoft/cpprestsdk/blob/master/Release/include/cpprest/http_client.h"
click node_clientcore "https://github.com/microsoft/cpprestsdk/blob/master/Release/src/http/client/http_client.cpp"
click node_clienttransport "https://github.com/microsoft/cpprestsdk/blob/master/Release/src/http/client/http_client_asio.cpp"
click node_httpmessage "https://github.com/microsoft/cpprestsdk/blob/master/Release/include/cpprest/http_msg.h"
click node_listener "https://github.com/microsoft/cpprestsdk/blob/master/Release/src/http/listener/http_listener.cpp"
click node_servertransport "https://github.com/microsoft/cpprestsdk/blob/master/Release/src/http/listener/http_server_asio.cpp"
click node_oauth "https://github.com/microsoft/cpprestsdk/blob/master/Release/src/http/oauth/oauth2.cpp"
click node_websocket "https://github.com/microsoft/cpprestsdk/blob/master/Release/include/cpprest/ws_client.h"
click node_wsruntime "https://github.com/microsoft/cpprestsdk/blob/master/Release/src/websockets/client/ws_client.cpp"
click node_wsmessage "https://github.com/microsoft/cpprestsdk/blob/master/Release/src/websockets/client/ws_msg.cpp"
click node_json "https://github.com/microsoft/cpprestsdk/blob/master/Release/src/json/json_parsing.cpp"
click node_jsonserialization "https://github.com/microsoft/cpprestsdk/blob/master/Release/src/json/json_serialization.cpp"
click node_uri "https://github.com/microsoft/cpprestsdk/blob/master/Release/src/uri/uri.cpp"
click node_streams "https://github.com/microsoft/cpprestsdk/blob/master/Release/include/cpprest/streams.h"
click node_fileio "https://github.com/microsoft/cpprestsdk/blob/master/Release/src/streams/fileio_posix.cpp"
click node_tasks "https://github.com/microsoft/cpprestsdk/blob/master/Release/include/pplx/pplxtasks.h"
click node_threadpool "https://github.com/microsoft/cpprestsdk/blob/master/Release/src/pplx/threadpool.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_httpclient,node_clientcore,node_clienttransport,node_httpmessage,node_listener,node_servertransport,node_oauth,node_developer toneBlue
class node_websocket,node_wsruntime,node_wsmessage toneAmber
class node_json,node_jsonserialization,node_uri,node_streams,node_fileio toneMint
class node_tasks,node_threadpool toneRose
```

## Components

### HTTP communication

- [HTTP client API](https://github.com/microsoft/cpprestsdk/blob/master/Release/include/cpprest/http_client.h): `Release/include/cpprest/http_client.h`
- [Client orchestration](https://github.com/microsoft/cpprestsdk/blob/master/Release/src/http/client/http_client.cpp): `Release/src/http/client/http_client.cpp`
- [Client transport](https://github.com/microsoft/cpprestsdk/blob/master/Release/src/http/client/http_client_asio.cpp): `Release/src/http/client/http_client_asio.cpp`
- [HTTP messages](https://github.com/microsoft/cpprestsdk/blob/master/Release/include/cpprest/http_msg.h): `Release/include/cpprest/http_msg.h`
- [HTTP listener](https://github.com/microsoft/cpprestsdk/blob/master/Release/src/http/listener/http_listener.cpp): `Release/src/http/listener/http_listener.cpp`
- [Server transport](https://github.com/microsoft/cpprestsdk/blob/master/Release/src/http/listener/http_server_asio.cpp): `Release/src/http/listener/http_server_asio.cpp`
- [OAuth flows](https://github.com/microsoft/cpprestsdk/blob/master/Release/src/http/oauth/oauth2.cpp): `Release/src/http/oauth/oauth2.cpp`

### WebSocket client

- [WebSocket API](https://github.com/microsoft/cpprestsdk/blob/master/Release/include/cpprest/ws_client.h): `Release/include/cpprest/ws_client.h`
- [WebSocket runtime](https://github.com/microsoft/cpprestsdk/blob/master/Release/src/websockets/client/ws_client.cpp): `Release/src/websockets/client/ws_client.cpp`
- [WebSocket messages](https://github.com/microsoft/cpprestsdk/blob/master/Release/src/websockets/client/ws_msg.cpp): `Release/src/websockets/client/ws_msg.cpp`

### Data and streams

- [JSON parsing](https://github.com/microsoft/cpprestsdk/blob/master/Release/src/json/json_parsing.cpp): `Release/src/json/json_parsing.cpp`
- [JSON serialization](https://github.com/microsoft/cpprestsdk/blob/master/Release/src/json/json_serialization.cpp): `Release/src/json/json_serialization.cpp`
- [URI handling](https://github.com/microsoft/cpprestsdk/blob/master/Release/src/uri/uri.cpp): `Release/src/uri/uri.cpp`
- [Async streams](https://github.com/microsoft/cpprestsdk/blob/master/Release/include/cpprest/streams.h): `Release/include/cpprest/streams.h`
- [File streams](https://github.com/microsoft/cpprestsdk/blob/master/Release/src/streams/fileio_posix.cpp): `Release/src/streams/fileio_posix.cpp`

### Async foundation

- [PPL tasks](https://github.com/microsoft/cpprestsdk/blob/master/Release/include/pplx/pplxtasks.h): `Release/include/pplx/pplxtasks.h`
- [Thread pool](https://github.com/microsoft/cpprestsdk/blob/master/Release/src/pplx/threadpool.cpp): `Release/src/pplx/threadpool.cpp`

### Other components

- **SDK user**

## Connections

- SDK user → HTTP client API: sends requests
- SDK user → HTTP listener: serves requests
- SDK user → WebSocket API: opens connection
- HTTP client API → Client orchestration: delegates
- Client orchestration → Client transport: dispatches
- Client orchestration → HTTP messages: handles messages
- HTTP listener → Server transport: uses transport
- HTTP client API → OAuth flows: supports OAuth (evidence: `Release/include/cpprest/http_client.h`)
- WebSocket API → WebSocket runtime: delegates (evidence: `Release/src/websockets/client/ws_client.cpp`)
- WebSocket runtime → WebSocket messages: handles messages
- HTTP messages → JSON parsing: supports JSON (evidence: `Release/include/cpprest/http_msg.h`)
- HTTP messages → Async streams: uses streams (evidence: `Release/include/cpprest/http_msg.h`)
- HTTP client API → URI handling: uses URI (evidence: `Release/include/cpprest/http_client.h`)
- File streams → Async streams: provides streams
- Client orchestration → PPL tasks: completes tasks
- Thread pool → PPL tasks: supports execution
