Reputation: 21
I'm working on a web application where I need to send data from the server to the client at specific times rather than continuously. I want to achieve this using either Server-Sent Events (SSE) or WebSockets.
Requirements: One-way communication: Data only flows from the server to the client. Timing control: Data should be sent only at predefined intervals or specific triggers, not continuously.
Questions: Can I use SSE for this purpose, and if so, how would I structure the server to send messages only at specified times? Would using WebSockets be a better approach for sending timed messages? If yes, how would that be implemented? Are there alternative methods (like HTTP polling or long polling) that could suit my needs better?
I initially tried using Server-Sent Events (SSE), but I found that it sends data continuously, which isn't what I need.
Upvotes: 2
Views: 62