Forum Discussion
spark_86682
Jul 28, 2011Historic F5 Account
I don't know anything about websockets, or how they work, or why the HTTP filter interferes with them (which to me is scary and bad; are they using another dreaded almost-but-not-quite-HTTP protocol?), and I can't quite follow your question. I *think* you're trying to resstablish a websocket to a different server when the original server goes down.
Once you disable HTTP (I can't remember if this happens immediately when you call HTTP::disable, or after that event finishes), all the HTTP information (e.g. HTTP::uri, etc.) and commands (e.g. HTTP::retry) are unusable. So that approach won't work.
If you want to attempt this, I think you'll need to use the TCP:: commands. In LB_FAILED, set a flag and create a variable which contains whatever the websocket handshake/request/etc. looks like, and then if that flag is set in SERVER_CONNECTED you can use TCP::respond to send it to the server.
All that assumes that websockets use some sort of well-defined request-response protocol with a single request per connection. If not, you'll need to do something much more complicated involving parsing the websocket stream and buffering the last request, etc.