Is it possible to only use WebSockets when necessary, otherwise use httpbatch or http?
I have an application, and on certain pages I need live data. Is there a way to only have tRPC open a websocket for subscriptions and then use another link otherwise?
I would like for the solution to disconnect from WS when all subscriptions have been ended, so no dangling WS connections.
5 Replies
Are you looking for splitLink?
ooh did not know that existed
will look into that
thanks
will splitLink keep an open WS even if it's not needed?
Try it! I haven't got any experience with our subscriptions
Feel free to pick up lazy mode