惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Cloudflare Blog
阮一峰的网络日志
阮一峰的网络日志
Martin Fowler
Martin Fowler
D
DataBreaches.Net
The GitHub Blog
The GitHub Blog
人人都是产品经理
人人都是产品经理
V
V2EX
爱范儿
爱范儿
PCI Perspectives
PCI Perspectives
T
Troy Hunt's Blog
Stack Overflow Blog
Stack Overflow Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
SecWiki News
SecWiki News
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Hacker News
The Hacker News
小众软件
小众软件
雷峰网
雷峰网
D
Docker
NISL@THU
NISL@THU
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
腾讯CDC
B
Blog RSS Feed
C
CERT Recently Published Vulnerability Notes
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
U
Unit 42
有赞技术团队
有赞技术团队
P
Palo Alto Networks Blog
G
GRAHAM CLULEY
T
The Exploit Database - CXSecurity.com
T
Tailwind CSS Blog
S
Security @ Cisco Blogs
量子位
I
InfoQ
Application and Cybersecurity Blog
Application and Cybersecurity Blog
大猫的无限游戏
大猫的无限游戏
Schneier on Security
Schneier on Security
Help Net Security
Help Net Security
Latest news
Latest news
The Register - Security
The Register - Security
S
Securelist
W
WeLiveSecurity
A
Arctic Wolf
Security Latest
Security Latest
AWS News Blog
AWS News Blog
L
LINUX DO - 热门话题
S
Secure Thoughts
T
Tenable Blog
Know Your Adversary
Know Your Adversary
月光博客
月光博客
M
MIT News - Artificial intelligence

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
How to Test WebSocket Connections Online in 2026 — A Debugging Field Guide
Rahul J · 2026-05-24 · via DEV Community

TL;DR

You don't need Postman or a paid tool to test WebSockets. In 2026, the four tools that cover 99% of real debugging are: the browser DevTools Network tab, an in-browser tester, wscat for CI, and a 20-line Node.js client. Pick by what you're verifying — handshake, message flow, close code, or auth header — not by habit.

If you want to skip the survey and just paste a wss:// URL into something that works, open a free browser-based WebSocket tester — no install, no signup, full handshake + close-code output.

The Bug That Inspired This Post

A real one. A team I was helping had a chat app dropping connections in production every 47 seconds. Local: fine. Staging: fine. Production: dead at 47s, every time.

Three engineers had spent two days on it. They were testing in Postman because that's the tool they knew. Postman happily reported "connected" and "disconnected" but gave them no useful detail about why the disconnect happened.

The fix took 90 seconds in a different tool: open an in-browser WebSocket tester, paste the production URL, watch the close frame come in as code 1006 (abnormal closure), then trace it back to the AWS ALB's idle timeout being 50 seconds with no app-level heartbeat. Send a ping every 30s, problem gone.

This is the lesson: the tool you reach for first determines what bug you can see. Most WebSocket bugs aren't "it didn't connect." They're "it connected, did some stuff, and died in an interesting way." If your tool only shows green/red, you're flying blind.

The Four Things You Actually Need to Verify

Before picking a tool, pin down what you're actually testing:

  1. The handshake — does the server return HTTP 101 Switching Protocols? Does it echo your Sec-WebSocket-Protocol?
  2. Bidirectional messaging — can text frames go both ways? Binary frames without corruption?
  3. Close behavior — when the connection drops, what close code comes back? 1000 (normal)? 1006 (abnormal)? 4xxx (your app's custom code)?
  4. Auth + headers — do cookies make it through? Authorization? Custom Sec-WebSocket-Protocol for token-as-subprotocol auth?

If your testing tool can't show you all four, you're going to miss bugs.

Tool 1 — Browser DevTools Network Tab (Always Available)

Best for: verifying your own frontend's existing connection, watching live messages during normal usage.

Open DevTools → Network → filter "WS" → click the connection. You get the upgrade headers, response, and a "Messages" sub-tab that streams frames in real time.

The limit: you cannot initiate a new connection here. You can only watch one your app already opened. So this is a passive tool — great for "what is my app actually sending?", useless for "is this server endpoint up?"

Tool 2 — In-Browser WebSocket Tester (Fastest for New Endpoints)

Best for: smoke-testing a new endpoint, ad-hoc message replay, sharing a repro with a teammate.

Paste a wss:// URL, click connect, type messages, watch the close code on disconnect. The whole point is zero setup — no npm install, no auth, no account.

I'm biased here: I built one because I was tired of every alternative either requiring a download or a login. The one on AllDevToolsHub runs entirely in your browser, shows the named close code (1006 → "Abnormal Closure"), and supports auth via subprotocols. But there are several — pick one you trust, since you'll paste auth tokens into it.

One gotcha: in-browser testers run from a different origin than your app. If your server checks Origin headers (it probably should), it may refuse the test connection. That refusal is itself useful debugging info — it means your origin check works.

Tool 3 — wscat (For Scripts and CI)

Best for: smoke tests in CI, reproducible test cases in bug reports.

npm install -g wscat
wscat -c wss://api.example.com/ws -H "Authorization: Bearer $TOKEN"

Now you have a terminal that sends text frames and prints incoming ones. Pipe stuff in, capture stuff out, exit code reflects success.

In CI:

echo '{"type":"ping"}' | timeout 5 wscat -c wss://api.example.com/ws -x '{"type":"ping"}' -w 2

wscat does not speak binary frames well and doesn't expose close codes prominently. For protocol-level debugging, use a real client. For "is the endpoint up?", it's perfect.

Tool 4 — A 20-Line Node.js Client (For Deep Debugging)

Best for: anything the above tools can't show you. Binary frames. Custom backpressure. Reconnect logic. Long-running soak tests.

import WebSocket from 'ws';

const ws = new WebSocket('wss://api.example.com/ws', {
  headers: { Authorization: `Bearer ${process.env.TOKEN}` },
});

ws.on('open', () => {
  console.log('[open]', new Date().toISOString());
  ws.send(JSON.stringify({ type: 'subscribe', channel: 'orders' }));
});

ws.on('message', (data, isBinary) => {
  console.log('[msg]', isBinary ? `<binary ${data.length}b>` : data.toString());
});

ws.on('close', (code, reason) => {
  console.log('[close]', code, reason?.toString() || '(no reason)');
});

ws.on('error', (err) => console.error('[error]', err.message));

// Heartbeat — this is what the 47-second-bug team was missing
setInterval(() => ws.ping(), 30000);

That's the whole thing. Drop into a file, node test.js, watch console. If you can't fit your test into 20 lines of Node, you're not testing — you're building.

The Production Gotchas You Won't Catch in Local Dev

These are the ones that bit me, in approximate order of how often I see them:

1. ALB / proxy idle timeouts. AWS Application Load Balancers default to a 50-second idle timeout. No heartbeat? Connection dies at 47-50s, every time. Cloudflare's default is 100s. Nginx's proxy_read_timeout is 60s. Always send an app-level ping at half the proxy's timeout.

2. Sticky sessions and reconnect. If you reconnect after a deploy, you may land on a different server with no memory of your session. Tools that don't expose the reconnect handshake make this invisible.

3. Origin header on wss://. Browsers send it, wscat and Node don't unless you explicitly add it. If you test from Node and it works, then test from a browser and it fails, check origin policy first.

4. Close codes ≠ status codes. 1006 is the code you'll see most in production, and it means "the close frame never arrived." Could be network, could be a crash, could be a proxy killing the connection. Don't treat it as an error type — treat it as "tell me more."

5. Sec-WebSocket-Protocol for token auth. When you can't set a cookie or Authorization header (browser WebSocket constructor doesn't accept custom headers), some apps pass tokens as a subprotocol. Your tester needs to support subprotocol negotiation, or you'll be debugging an auth bug as a "handshake failure."

Common Mistakes I See in WebSocket Tests

These get bookmarked and shared more than anything else in this post, so here they are upfront:

  • Testing only the happy path. A WebSocket test that doesn't include a forced disconnect is incomplete. Pull the network cable. Kill the process. Send a malformed frame. See what your client does.
  • Confusing onerror with the close code. Browsers fire a generic error event and then fire close with the actual reason. If you only log the error, you've thrown away the diagnostic.
  • Assuming ping/pong is automatic. It isn't in browsers. The ws Node library does it. socket.io does it. Raw browser WebSocket does not.
  • Forgetting that 4xxx close codes are your responsibility. Codes 4000-4999 are reserved for application use. If you're not defining any, you're throwing away information at exactly the point things go wrong.
  • Testing against localhost and shipping to production. Local doesn't have proxies, idle timeouts, or origin enforcement. The whole point of a remote tester is to catch what local hides.

Quick Reference: When to Use Which Tool

Scenario Best Tool Why
"Is this endpoint alive?" wscat or in-browser tester Fastest path to a yes/no
"What is my frontend sending?" DevTools Network tab Already there, passive observation
"Why does it die at 47 seconds?" In-browser tester (for close code) → Node script (for ping cadence) Need close-code visibility, then heartbeat customization
"Does auth work?" wscat with -H "Authorization: ..." or Node script Browser WebSocket can't set arbitrary headers
"Soak test for 6 hours" Node script in a loop Only thing flexible enough
"Repro in a bug report" wscat command + paste output Reproducible, copy-pasteable

Try It Online

The fastest way to test a WebSocket endpoint right now: paste the URL into AllDevToolsHub's WebSocket Tester. It runs entirely in your browser, shows the handshake + every frame + the named close code, and you don't sign up for anything. If you want the deeper version of this guide — RFC 6455 details, full close-code reference, end-to-end auth examples — read the full guide on AllDevToolsHub.

FAQ

What's the difference between wss:// and ws://?
wss:// is WebSocket over TLS (the WebSocket equivalent of HTTPS). Always use it in production. Browsers refuse ws:// from HTTPS pages anyway.

Why does my connection die at exactly 50 or 60 seconds?
Proxy idle timeout. AWS ALB defaults to 50s, Nginx to 60s. Add a ping every 30s from either client or server.

Can I test WebSockets from curl?
Only the handshake (curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" ...). Once the connection upgrades, curl can't read the framed protocol. Use wscat instead.

Do I need Postman for WebSocket testing?
No. Postman's WebSocket support is fine but the free browser-based tools cover the same ground without the install. Postman is worth it for REST + WebSocket + GraphQL in one place; for WebSockets alone it's overkill.

What's the most important close code to know?
1006 — "abnormal closure." It means the close frame never made it across, which means something killed the connection unexpectedly. You will see this constantly. Full close-code reference is here.


Originally published on AllDevToolsHub. For privacy-first browser-based developer tools — WebSocket Tester, JWT Decoder, Regex Tester, and 250+ more — see alldevtoolshub.com.