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 });
}Each virtual user maintains one WebSocket connection. With 200 free VUs, you can test 200 concurrent connections. Scale to thousands on paid plans.
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.
Load test your REST and GraphQL APIs with up to 200 virtual users for free. Real-time metrics, JavaScript scripting, and instant results.
Load test your GraphQL API with realistic queries and mutations. Measure resolver performance and find N+1 query bottlenecks.
Test how your application handles sudden traffic spikes. Simulate flash sales, viral moments, and DDoS-like scenarios safely.