How to use two different backend for websockets for different url path

I have a use case where i want to connect to different backend on websockets for different url path

For eg: my haproxy hostname is test.haproxy.com which has ssl configured i.e. https://test.haproxy.com works fine

I have two URLs i.e. /a and /b

For /a i want to connect to a backend A where server is A and for /b i want to connect to a backend B where server is B.

How can i achieve this, also is it possible to connect to websocket via wss://test.haproxy.com/a for /a and wss://test.haproxy.com/b for /b.

Thanks in advance