Building Real-time Applications with WebSockets.
Real-time with WebSockets
WebSockets enable two-way communication between client and server.
// Client-side JavaScript
const socket = new WebSocket('ws://localhost:8000/ws/');
socket.onmessage = function(event) {
const data = JSON.parse(event.data);
console.log('Message from server:', data);
};