> ## Documentation Index
> Fetch the complete documentation index at: https://akshanshgusain.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Application Layer Protocols

> Introduction to Layer 7 Protocols

## 1. HTTP (Hypertext Transfer Protocol)

The most widely used protocol on the web for request-response communication.

Pattern: Synchronous request/response

Transport: TCP

Stateless: Yes

Use Cases: Web APIs (REST), websites, microservices communication

Protocols on top: REST, GraphQL, gRPC (over HTTP/2)

## 2. WebSocket

A full-duplex communication protocol over a single, long-lived TCP connection.

Pattern: Bidirectional streaming

Transport: TCP (via HTTP handshake)

Stateful: Yes

Use Cases: Real-time apps like chat, gaming, live dashboards

Compared to HTTP: Persistent and allows server push

## 3. gRPC

A high-performance RPC framework using HTTP/2 and Protocol Buffers.

Pattern: Client-server, supports streaming and unary calls

Transport: HTTP/2

Efficient: Binary data (Protobuf)

Use Cases: Internal service communication, mobile/backend APIs

## 4. MQTT (Message Queuing Telemetry Transport)

A lightweight Pub/Sub protocol optimized for unreliable or low-bandwidth networks.

Pattern: Publish-Subscribe

Transport: TCP/IP

Features: QoS levels, retained messages, last will

Use Cases: IoT devices, telemetry, sensors

## 5. AMQP (Advanced Message Queuing Protocol)

A binary, application-layer protocol for message-oriented middleware.

Pattern: Supports both Point-to-Point and Pub/Sub

Transport: TCP

Features: Queues, topics, routing, transactions

Used By: RabbitMQ, Apache Qpid

## 6. SMTP (Simple Mail Transfer Protocol)

Protocol for sending email between servers.

Pattern: Push (store-and-forward)

Transport: TCP (port 25/587)

Use Cases: Email services

## 7. XMPP (Extensible Messaging and Presence Protocol)

An XML-based messaging protocol.

Pattern: Publish-Subscribe, Chat

Transport: TCP

Use Cases: Instant messaging, presence systems (e.g., Jabber)

## Summary

| Protocol  | Pattern             | Transport | Default Port | Common Use Case        |
| :-------- | :------------------ | :-------- | :----------- | :--------------------- |
| HTTP      | Request/Response    | TCP       | 80/443       | Web, APIs              |
| WebSocket | Full-duplex         | TCP       | 80/443       | Real-time apps         |
| SMTP      | Push                | TCP       | 25/587       | Sending email          |
| IMAP      | Pull                | TCP       | 143/993      | Reading email          |
| POP3      | Pull (delete local) | TCP       | 110/995      | Reading email          |
| SSH       | Remote shell        | TCP       | 22           | Secure remote access   |
| FTP       | File Transfer       | TCP       | 21           | File uploads/downloads |
| DNS       | Lookup              | UDP/TCP   | 53           | Domain resolution      |
| SNMP      | Monitoring          | UDP       | 161          | Network management     |
| Telnet    | Remote shell        | TCP       | 23           | Legacy access          |
| gRPC      | RPC                 | HTTP/2    | 50051        | Microservices, APIs    |
| MQTT      | Pub/Sub             | TCP       | 1883/8883    | IoT messaging          |
| AMQP      | P2P + Pub/Sub       | TCP       | 5672/5671    | Enterprise messaging   |
| XMPP      | Messaging + Pub/Sub | TCP       | 5222         | Chat systems           |
| CoAP      | REST + Pub/Sub      | UDP       | 5683         | Lightweight IoT        |
