β‘ Full-Duplex Persistent Streams & Real-Time Protocol Governance
Traditional HTTP request-response architectures force clients to poll servers repeatedly for updates, generating excessive network overhead and high latency for interactive systems. WebSockets (RFC 6455) solve this by establishing a persistent, bidirectional, full-duplex communication channel over a single TCP socket connection. Initiated through a standard HTTP Upgrade handshake, a WebSocket connection remains open, allowing clients and servers to exchange lightweight data frames (text or binary) instantaneously with minimal transport framing. Postman provides a dedicated WebSocket Client Interface that supports raw WebSocket endpoints (ws:// and wss://), higher-level application protocols like Socket.io and SignalR, saved message libraries, dynamic variable interpolation, and live message timeline filtering for inspecting real-time streaming architectures.
RFC 6455 WEBSOCKET PROTOCOL LIFECYCLE TOPOGRAPHY:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β STEP 1: INITIAL HTTP UPGRADE HANDSHAKE (Client to Gateway) β
β GET /v1/realtime/stream HTTP/1.1 β
β Host: realtime.nikita-infotech.com β
β Upgrade: websocket β
β Connection: Upgrade β
β Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ== β
β Sec-WebSocket-Version: 13 β
β Sec-WebSocket-Protocol: v1.json-stream, telemetry β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ (Server evaluates and confirms upgrade)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β STEP 2: PROTOCOL SWITCHING RESPONSE (Gateway to Client) β
β HTTP/1.1 101 Switching Protocols β
β Upgrade: websocket β
β Connection: Upgrade β
β Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo= (SHA-1 hash of key + RFC 6455 GUID) β
β Sec-WebSocket-Protocol: v1.json-stream β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ (TCP socket remains open; shifts to framing)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β STEP 3: PERSISTENT BIDIRECTIONAL FULL-DUPLEX DATA FRAMING β
β - Client Frames (Masked): Text JSON, ArrayBuffer binary, Blob media β
β - Server Frames (Unmasked): Server-Sent telemetry events, live push notifications β
β - Control Frames: 0x9 Ping / 0x0A Pong (Heartbeat keep-alive) | 0x8 Close Frame (Teardown) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
wss://), request headers, subprotocols, and manages connection state via the Connect/Disconnect lifecycle controls.
POSTMAN WEBSOCKET INTERFACE SETUP:
1. CREATE WEBSOCKET REQUEST:
- Click "New" in Postman top navigation -> Select "WebSocket".
- Or click the dropdown beside "+" tab -> Select "WebSocket Request".
2. CONFIGURE CONNECTION ATTRIBUTES:
βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FIELD β CONFIGURATION VALUE / EXPRESSION β
βββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Protocol Scheme β wss:// (TLS Encrypted WebSocket) β
β Server URL β wss://realtime.nikita-infotech.com/v1/students/live-events β
β Subprotocols β json.v1, student-telemetry.v1 (Sec-WebSocket-Protocol) β
βββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
3. CONFIGURE CONNECTION HEADERS (Handshake Tab):
Headers sent exclusively during the initial HTTP 101 Upgrade phase:
βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β HEADER KEY β HEADER VALUE β
βββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Authorization β Bearer {{activeBearerToken}} β
β X-Client-Tenant β MH-PUNE-WEST-01 β
β X-App-Version β 2026.4.1 β
βββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
4. CONNECT & MONITOR:
- Click the blue "Connect" button.
- Status bar transitions: Connecting... βββΊ Connected (Green indicator).
- The connection remains open until you manually click "Disconnect" or the server closes.
{{environment}} variables, and dispatching text frames through the composer.
-- 1. MESSAGE COMPOSER CONFIGURATION --
Format: JSON
Target: Active Connection (wss://realtime.nikita-infotech.com)
-- 2. STRUCTURED SUBSCRIPTION REQUEST PAYLOAD --
{
"action": "SUBSCRIBE_STUDENT_EVENTS",
"requestId": "{{$randomUUID}}",
"clientTimestamp": {{$timestamp}},
"authContext": {
"tenantId": "{{tenantCode}}",
"sessionId": "{{activeSessionToken}}"
},
"filterCriteria": {
"studentId": "{{activeStudentId}}",
"eventTypes": [
"ENROLLMENT_CONFIRMED",
"TUITION_PROCESSED",
"GRADE_POSTED"
],
"includeMetadata": true
}
}
-- 3. RESOLVED WIRE PAYLOAD SENT TO SERVER (SAMPLE) --
{
"action": "SUBSCRIBE_STUDENT_EVENTS",
"requestId": "c9bf124e-89a0-4bc1-1234-81029ba8f9b1",
"clientTimestamp": 1793524800,
"authContext": {
"tenantId": "MH-PUNE-WEST-01",
"sessionId": "eyJhbGciOiJIUzI1NiIsInR5..."
},
"filterCriteria": {
"studentId": "STU-88219",
"eventTypes": ["ENROLLMENT_CONFIRMED", "TUITION_PROCESSED", "GRADE_POSTED"],
"includeMetadata": true
}
}
POSTMAN MESSAGE TIMELINE CONTROLS & EVENT LOG:
TIMELINE CONTROLS TOOLBAR:
βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CONTROL β OPERATIONAL FUNCTIONALITY β
βββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Search Messages β Full-text search across all incoming/outgoing frame contentsβ
β Direction Filter β Toggle "All", "Sent (β)", or "Received (β)" β
β Message Type β Filter by Text, Binary, or Control Frames (Ping/Pong) β
β Clear Timeline β Clears current message view without terminating socket β
βββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
CHRONOLOGICAL EVENT LOG AUDIT (TIMELINE VIEW):
[13:42:00.100] ββ Connected to wss://realtime.nikita-infotech.com/v1/students/live-events
[13:42:01.124] β Sent (JSON, 384 B)
{ "action": "SUBSCRIBE_STUDENT_EVENTS", "studentId": "STU-88219" }
[13:42:01.142] β Received (JSON, 186 B)
{ "status": "ACKNOWLEDGED", "streamId": "STR-4482", "activeListeners": 1 }
[13:42:05.450] β Received (JSON, 512 B)
{
"event": "TUITION_PROCESSED",
"studentId": "STU-88219",
"transaction": { "amount": 14999.00, "currency": "INR", "status": "SETTLED" },
"timestamp": 1793524805
}
[13:42:15.000] β Ping / Pong Heartbeat Exchanged (Control frame 0x9 / 0x0A, 0 B)
POSTMAN SAVED MESSAGE LIBRARY ARCHITECTURE:
In the WebSocket interface, click "Save Message" to organize reusable message templates:
ββββββββββββββββββββββββββββββββββββββββ¬ββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββ
β SAVED MESSAGE TITLE β FORMAT β PRIMARY OPERATIONAL PURPOSE β
ββββββββββββββββββββββββββββββββββββββββΌββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββ€
β 01_Client_Handshake_Ack β JSON β Sends initial client session registration β
β 02_Subscribe_Course_Enrollment_Feed β JSON β Requests stream for specific course ID β
β 03_Publish_Candidate_Attendance_Ping β JSON β Emulates real-time attendance beacon update β
β 04_Heartbeat_Application_Ping β JSON β Application-layer keep-alive packet β
β 05_Negative_Malformed_Action_Probe β JSON β Tests server validation on unrecognized eventβ
ββββββββββββββββββββββββββββββββββββββββ΄ββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββ
SAVED VECTOR EXAMPLE: "05_Negative_Malformed_Action_Probe"
{
"action": "UNSUPPORTED_MALFORMED_EVENT_ACTION",
"payload": {
"maliciousInjection": "' OR 1=1; --"
}
}
SERVER RESPONSE UPON DISPATCH:
{
"status": "ERROR",
"errorCode": "INVALID_ACTION_SCHEMA",
"message": "Action 'UNSUPPORTED_MALFORMED_EVENT_ACTION' is not supported by this gateway."
}
socket.emit()), event listening (socket.on()), and engine negotiation.
POSTMAN SOCKET.IO CLIENT CONFIGURATION:
1. SELECT PROTOCOL:
- When creating a WebSocket request, choose "Socket.io" from the protocol dropdown.
- Socket.io URL: https://realtime.nikita-infotech.com (Path defaults to /socket.io).
2. CONFIGURATION OPTIONS:
βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FIELD β CONFIGURATION VALUE β
βββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Server URL β https://realtime.nikita-infotech.com β
β Client Version β v4 (or select v2/v3 depending on backend engine) β
β Handshake Path β /socket.io (Default) β
β Auth Payload β { "token": "{{activeBearerToken}}" } β
βββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
3. LISTEN FOR EVENTS (EVENTS TAB):
Add event listeners before connecting:
- Event: "student:enrolled"
- Event: "notification:broadcast"
- Event: "system:alert"
4. EMIT AN EVENT (EVENT COMPOSER):
Event Name: "student:update-status"
Event Args (JSON):
{
"studentId": "{{activeStudentId}}",
"newStatus": "ACTIVE_ATTENDING",
"timestamp": {{$timestamp}}
}
- Click "Send" to emit the named event to the server.
0x9 Ping and 0x0A Pong frames in Postman to troubleshoot idle connection drops caused by load balancers and proxy timeouts.
WEBSOCKET CONTROL FRAMES TELEMETRY & PROXY TIMEOUTS:
WHY CONNECTIONS TERMINATE PREMATURELY:
- Cloudflare, AWS ALB, and NGINX enforce idle connection timeouts (typically 60s).
- If no data frames cross the wire for 60 seconds, proxies terminate the TCP socket!
- RFC 6455 defines Control Frames to maintain socket vitality:
βββ Opcode 0x9 : Ping Frame (Sent by client or server to check health)
βββ Opcode 0xA : Pong Frame (Sent immediately in response to a Ping)
βββ Opcode 0x8 : Connection Close Frame
OBSERVING HEARTBEATS IN POSTMAN:
1. In the Message Timeline filter, select "Control Messages".
2. Postman's engine handles standard RFC 6455 pings automatically in the background.
3. If an application-layer heartbeat is required, configure a periodic ping message:
APPLICATION-LAYER KEEP-ALIVE MESSAGE (JSON):
{
"type": "HEARTBEAT_PING",
"timestamp": {{$timestamp}}
}
EXPECTED GATEWAY PONG ACKNOWLEDGMENT:
{
"type": "HEARTBEAT_PONG",
"serverTime": 1793524830,
"status": "HEALTHY"
}
Opcode 0x2), useful for Protocol Buffers (Protobuf), MessagePack, and compressed binary streams.
SENDING BINARY FRAMES IN POSTMAN:
1. SELECT BINARY COMPOSER:
- In the message composer, switch format dropdown from "Text" to "Binary".
- Select input mode: "Hex" or "File".
2. OPTION A: DISPATCHING RAW HEXADECIMAL FRAMES:
Input raw hex bytes directly:
01 04 53 54 55 2D 38 38 32 31 39 00 00 01
(Binary header + string length prefix + "STU-88219" + flags)
- Click "Send". Postman dispatches a binary frame (Opcode 0x2).
3. OPTION B: DISPATCHING SERIALIZED BINARY ASSETS:
- Click "Select File" -> upload serialized Protobuf payload (candidate_record.pb).
- Postman streams the file bytes directly across the WebSocket.
4. INSPECTING INCOMING BINARY FRAMES:
- When the server emits a binary message, the timeline displays:
"β Received (Binary, 128 B)"
- Clicking the message toggles between:
βββ Hex View: Displays raw hex bytes alongside ASCII characters
βββ Base64 View: Decodes frame into Base64 representation
βββ Text View: Attempts UTF-8 string decoding if binary contains text
RFC 6455 WEBSOCKET CLOSE CODES SPECIFICATION:
ββββββββββββββββ¬βββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββ
β CLOSE CODE β STATUS TITLE β OPERATIONAL MEANING & CAUSE β
ββββββββββββββββΌβββββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββ€
β 1000 β Normal Closure β Socket completed purpose; clean intentional exitβ
β 1001 β Going Away β Server restarting or client navigating away β
β 1002 β Protocol Error β Endpoint received frame violating RFC 6455 spec β
β 1003 β Unsupported Data β Received binary data when only text is accepted β
β 1006 β Abnormal Closure β Connection dropped abruptly without close frame β
β 1008 β Policy Violation β Authentication failed or invalid permissions β
β 1009 β Message Too Big β Message exceeded server buffer ceiling (e.g. 1MBβ
β 1011 β Internal Server Error β Unexpected server exception crashed the worker β
ββββββββββββββββ΄βββββββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββββββββ
DISCONNECTION DIAGNOSTIC LOG IN POSTMAN:
[13:45:00.120] ββ Disconnected from wss://realtime.nikita-infotech.com
Status Code: 1000 (Normal Closure)
Reason: "Client session terminated cleanly via user disconnect."
ABNORMAL DISCONNECTION EXAMPLE (EXPIRED AUTH TOKEN):
[13:45:12.450] ββ Disconnected from wss://realtime.nikita-infotech.com
Status Code: 1008 (Policy Violation)
Reason: "JWT Bearer token expired during active stream."
WEBSOCKET CLIENT INTERFACE SPECIFICATION MATRIX:
βββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ¬βββββββββββββββββββ¬ββββββββββββββββββββββββββββββββ
β COMPONENT / DIRECTIVE β CONFIGURATION SYNTAX β SPECIFICATION β PRIMARY OPERATIONAL PURPOSE β
βββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββΌββββββββββββββββββββββββββββββββ€
β Secure Scheme (TLS) β wss://endpoint.domain.com β RFC 6455 Β§3 β Encrypted WebSocket over TLS β
β Handshake Upgrade β Connection: Upgrade β RFC 6455 Β§4.1 β Initiates protocol switching β
β Subprotocols β Sec-WebSocket-Protocol β RFC 6455 Β§1.9 β Negotiates application format β
β Text Data Frame β Opcode 0x1 (JSON / String) β RFC 6455 Β§5.2 β Carries text message payloads β
β Binary Data Frame β Opcode 0x2 (Hex / Buffer) β RFC 6455 Β§5.2 β Carries binary / Protobuf dataβ
β Ping Control Frame β Opcode 0x9 (Heartbeat) β RFC 6455 Β§5.5.2 β Tests channel vitality β
β Pong Control Frame β Opcode 0xA (Acknowledgment) β RFC 6455 Β§5.5.3 β Responds to Ping frame β
β Normal Close β Status Code 1000 β RFC 6455 Β§7.4.1 β Clean intentional termination β
β Policy Violation Close β Status Code 1008 β RFC 6455 Β§7.4.1 β Rejects unauthorized stream β
β Socket.io Support β Client v4 / v3 Engine Mode β Socket.io Engine β Event-driven pub/sub testing β
βββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββ΄βββββββββββββββββββ΄ββββββββββββββββββββββββββββββββ€
β TOP 5 WEBSOCKET TESTING BEST PRACTICES: β
β 1. Always use secure wss:// schemes: Protect streaming data and tokens with TLS in all environments. β
β 2. Pass authentication in handshake headers: Transmit Bearer tokens during HTTP upgrade, not in messages. β
β 3. Monitor heartbeat ping/pong frames: Identify proxy idle drops before assuming server crashes. β
β 4. Build saved message libraries: Standardize subscriptions, status updates, and negative probes. β
β 5. Audit close status codes: Confirm connections close with 1000 for normal exits and 1008 for auth fails.β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ