4 ms·
My advice: • Make push updates optional. If no push connection can be established, fall back to polling. You can start by implementing polling only and add pus
by loevborg 5y ago
My advice:
• Make push updates optional. If no push connection can be established, fall back to polling. You can start by implementing polling only and add push later.
• Use websockets only for server-to-client communication. Messages from the client are sent via regular HTTP requests.
• Keep no meaningful state on the server. That includes TCP connection state. You should be able to kill all your ec2 instances and re-spawn them without interrupting service.
• Use request/response for all logic on the server. All your code should be able to run in an AWS lambda.
• Use a channel/subscription paradigm so client can connect to streams they're interested in
• Instead of rolling your own websocket server, use a hosted service like pusher.com or ably.com. They do all the heavy lifting for you (like keeping thousands of TCP connections open) and provide a request/response style interface for your server to send messages to connected clients
- tata71 5y agoWhat are the downsides? Are these hosted services just AWS?