Q1. What is a WebSocket and how is it different from a regular HTTP request?
A WebSocket is a long-lived, two-way connection between a browser and a server that stays open after it is created, so either side can send messages at any time without re-connecting. A regular HTTP request is one round trip: the client asks, the server answers, the connection closes. WebSockets are the right choice when you need real-time updates pushed to the user without polling.