WebSocket Load Testing

Validate real-time connection performance

Open hundreds of concurrent WebSocket connections and exchange messages at scale. Measure connection establishment time, message latency, and throughput under load.

What you get

  • Concurrent WebSocket connection testing
  • Message send/receive latency tracking
  • Connection stability under load
  • Custom message payloads (JSON, binary)
  • Reconnection and error handling patterns
  • Compatible with Socket.io and raw WebSockets
websocket-test.js
import ws from 'k6/ws';
import { check } from 'k6';

export const options = { vus: 100, duration: '2m' };

export default function () {
  const res = ws.connect('wss://echo.example.com', {}, (socket) => {
    socket.on('open', () => {
      socket.send(JSON.stringify({ type: 'ping' }));
    });

    socket.on('message', (msg) => {
      check(msg, {
        'got response': (m) => m.length > 0,
      });
    });

    socket.setTimeout(() => socket.close(), 10000);
  });

  check(res, { 'connected': (r) => r && r.status === 101 });
}

Frequently Asked Questions

How many WebSocket connections can I test?

Each virtual user maintains one WebSocket connection. With 200 free VUs, you can test 200 concurrent connections. Scale to thousands on paid plans.

Does it work with Socket.io?

Yes. Socket.io uses WebSocket as the transport layer. You can test Socket.io servers by connecting to the WebSocket endpoint directly with appropriate handshake headers.

Ready to start websocket load testing?

Sign up free — no credit card required. Get 200 VUs and 5 minute tests instantly.

loadtest.dev

© 2026 loadtest.dev