Methods of interaction between client and server
Methods of interaction between client and server
HTTP/HTTPS
(REST APIs)
explain architecture shortly (GET/PATCH/PUT/POST/ DELETE for updates)
PUT/ PATCH - PUT entire instance update, PATCH partially updates
Principles (find all principles):
Serverless
Send response in JSON (Only?)
Caching
Layered architecture
Standard request-response protocol. Client sends requests, server responds.
Use case: CRUD operations, typical web APIs
Pros: Universal, stateless, cacheable
Cons: Request overhead, no real-time support
GraphQL via http/ https
RPC (gRPC, tRPC)
High-performance RPC framework using HTTP/2 and Protocol Buffers.
Use case: Microservices, low-latency requirements, polyglot systems
Pros: Fast, strongly typed, bidirectional streaming
Cons: Limited browser support, binary format
-- Real time communication methods
WebRTC
Peer-to-peer communication with optional signaling server.
Use case: Video/audio calls, file sharing, real-time gaming
Pros: P2P (low latency), media streaming support
Cons: Complex setup, NAT traversal issues
Web Sockets
Query language allowing clients to request specific data structures.
Use case: Complex data requirements, mobile apps, multiple data sources
Pros: Flexible queries, single endpoint, prevents over/under-fetching
Cons: Learning curve, caching complexity
Event Sourcing and Server-Sent Events (SSE)
Unidirectional push from server to client over HTTP.
Use case: Live notifications, stock tickers, news feeds
Pros: Simpler than WebSockets, auto-reconnect, built-in event IDs
Cons: One-way only, HTTP limitations
Regular (Short) polling
Short Polling
Client repeatedly sends requests at fixed intervals, server responds immediately with current data (or "no update").
How It Works:
Client sends request → "Any updates?"
Server responds immediately → With data or "no updates"
Client waits fixed interval (e.g., 5 seconds)
Repeat from step 1
Long Polling
Client repeatedly requests server until new data is available.
Use case: Legacy real-time needs, fallback mechanism
Pros: Works everywhere, simple
Cons: Inefficient, high overhead