Hi, TorQ provides re-subscribe logic in subscriptions.q provided below.
.sub.subscribe calls a function .sub.autoreconnect which tries to reconnect to any previously subscribed tables/instruments. Initially two variables are checked .sub.AUTORECONNECT which is set to 1b in the script and if .sub.reconnectinit.
It can be done using the built-in handlers .z.pc (connection close) and .z.ts (timer). When the connection closes, you could set up a periodic timer that tries to reopen the connection.
Because doing this at the low level is cumbersome and is kind of reinventing the wheel, there are open source implementations that allow setting timers and auto-reconnecting connections, such as this one: