# gurizzu/go-reqws architecture

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

- Interactive diagram: https://gitdiagram.com/gurizzu/go-reqws
- Repository: https://github.com/gurizzu/go-reqws

## Overview

go-reqws is a Go client library for making configurable HTTP requests and maintaining channel-based WebSocket streams. Its main workflow is: a caller configures a client and request options, invokes an HTTP method that executes the request (optionally with retries and hooks), then inspects a response or error. A separate WebSocket workflow supports streaming and optional reconnection. The excerpts show the retry and WebSocket control flow; some HTTP pipeline details and documented capabilities are represented at the level supported by the README.

Main entry points: [`requests.go`](https://github.com/gurizzu/go-reqws/blob/master/requests.go) (HTTP methods), [`ws.go`](https://github.com/gurizzu/go-reqws/blob/master/ws.go) (WebSocket stream), [`retry.go`](https://github.com/gurizzu/go-reqws/blob/master/retry.go) (Retry policy), [`errors.go`](https://github.com/gurizzu/go-reqws/blob/master/errors.go) (Typed errors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP requests"]
  node_client["Client setup<br/>[requests.go]"]
  node_options["Request options<br/>[requests.go]"]
  node_http_api["HTTP methods<br/>[requests.go]"]
  node_http_exec["HTTP execution<br/>[requests.go]"]
  node_response["Response helpers<br/>[requests.go]"]
end

subgraph group_resilience["Resilience and hooks"]
  node_retry["Retry policy<br/>[retry.go]"]
  node_middleware["Request hooks<br/>[middleware.go]"]
end

subgraph group_websocket["WebSocket streaming"]
  node_ws_stream["WebSocket stream<br/>[ws.go]"]
  node_ws_reconnect["Reconnect policy<br/>[ws.go]"]
end

subgraph group_errors["Error handling"]
  node_error_types["Typed errors<br/>[errors.go]"]
end

node_caller(("Library caller"))
node_service(("HTTP service"))

node_caller -->|"creates"| node_client
node_caller -->|"configures"| node_options
node_caller -->|"invokes"| node_http_api
node_http_api -->|"executes through"| node_retry
node_retry -->|"calls"| node_http_exec
node_http_exec -.->|"sends request"| node_service
node_http_api -->|"returns"| node_response
node_middleware -.->|"hooks pipeline"| node_http_exec
node_caller -->|"starts stream"| node_ws_stream
node_ws_reconnect -->|"retries stream"| node_ws_stream
node_caller -->|"configures"| node_ws_reconnect
node_http_api -.->|"reports HTTP errors"| node_error_types
node_ws_stream -->|"reports stream errors"| node_error_types

click node_client "https://github.com/gurizzu/go-reqws/blob/master/requests.go"
click node_options "https://github.com/gurizzu/go-reqws/blob/master/requests.go"
click node_http_api "https://github.com/gurizzu/go-reqws/blob/master/requests.go"
click node_http_exec "https://github.com/gurizzu/go-reqws/blob/master/requests.go"
click node_response "https://github.com/gurizzu/go-reqws/blob/master/requests.go"
click node_retry "https://github.com/gurizzu/go-reqws/blob/master/retry.go"
click node_middleware "https://github.com/gurizzu/go-reqws/blob/master/middleware.go"
click node_ws_stream "https://github.com/gurizzu/go-reqws/blob/master/ws.go"
click node_ws_reconnect "https://github.com/gurizzu/go-reqws/blob/master/ws.go"
click node_error_types "https://github.com/gurizzu/go-reqws/blob/master/errors.go"

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_client,node_options,node_http_api,node_http_exec,node_response toneBlue
class node_retry,node_middleware toneAmber
class node_ws_stream,node_ws_reconnect toneMint
class node_error_types toneRose
class node_caller,node_service toneIndigo
```

## Components

### HTTP requests

- [Client setup](https://github.com/gurizzu/go-reqws/blob/master/requests.go): `requests.go`
- [Request options](https://github.com/gurizzu/go-reqws/blob/master/requests.go): `requests.go`
- [HTTP methods](https://github.com/gurizzu/go-reqws/blob/master/requests.go): `requests.go`
- [HTTP execution](https://github.com/gurizzu/go-reqws/blob/master/requests.go): `requests.go`
- [Response helpers](https://github.com/gurizzu/go-reqws/blob/master/requests.go): `requests.go`

### Resilience and hooks

- [Retry policy](https://github.com/gurizzu/go-reqws/blob/master/retry.go): `retry.go`
- [Request hooks](https://github.com/gurizzu/go-reqws/blob/master/middleware.go): `middleware.go`

### WebSocket streaming

- [WebSocket stream](https://github.com/gurizzu/go-reqws/blob/master/ws.go): `ws.go`
- [Reconnect policy](https://github.com/gurizzu/go-reqws/blob/master/ws.go): `ws.go`

### Error handling

- [Typed errors](https://github.com/gurizzu/go-reqws/blob/master/errors.go): `errors.go`

### Other components

- **Library caller**
- **HTTP service**

## Connections

- Library caller → Client setup: creates (evidence: `README.md`)
- Library caller → Request options: configures (evidence: `README.md`)
- Library caller → HTTP methods: invokes (evidence: `README.md`)
- HTTP methods → Retry policy: executes through (evidence: `requests.go`)
- Retry policy → HTTP execution: calls (evidence: `retry.go`)
- HTTP execution → HTTP service: sends request
- HTTP methods → Response helpers: returns (evidence: `README.md`)
- Request hooks → HTTP execution: hooks pipeline (evidence: `README.md`)
- Library caller → WebSocket stream: starts stream (evidence: `README.md`)
- Reconnect policy → WebSocket stream: retries stream (evidence: `ws.go`)
- Library caller → Reconnect policy: configures (evidence: `README.md`)
- HTTP methods → Typed errors: reports HTTP errors (evidence: `README.md`)
- WebSocket stream → Typed errors: reports stream errors (evidence: `ws.go`)
