WebSockets allow duplexed connection between client and server.
Use WebSockets sparingly. WebSockets are not a straight up improvement from AJAX requests, there are trade-offs.
Debugging WebSockets is a lot harder than debugging AJAX requests.
Web browsers allow easily over 200+ WebSockets per host by default. This means when a user opens your site in multiple tabs, all WebSockets are duplicated. This is why you should design your website to use only a single WebSocket, and even this might be too much to handle. You should make WebSockets to close down when not used for a while and reconnect as needed like user views the tab again.
Each WebSocket connection simply cannot have an ongoing database connection. You will hit database connection limit really fast. Only read cached values and make another process update that cache.