I’m looking to migrate a web app to Fly.io that makes use of WebSockets for much of its communication. Because of how it is structured, sometimes only a single instance of the server will be able to handle a request, so I would like to make use of the fly-replay
header to direct requests to specific instances. I did a bit of searching and found some complications with using WebSockets with that header, but they all seem quite outdated.
Here’s how I see it functioning:
Client: Sends a WebSocket request
Fly Proxy: Directs the request to the instance it deems best, Instance 1
Instance 1: Realizes that it can’t handle the request but figures out that Instance 2 can, and tells the proxy to replay the request on Instance 2
Fly Proxy: Replays the request on Instance 2
Instance 2: Fulfills the request and establishes a WebSocket connection with the Client
Could somebody tell me if this sort of scenario is possible using Fly.io?