Hi Javier,
I had to restart some servers recently, cutting all the opened connections. This was exceptional.
tmate should not drop sessions.
Further, the tmate client should support some reconnection feature at some point, to reconnect if the connection was dropped.
this is a little complicated, because 1) it might reconnect to a different server 2) all the terminal panes must be re-synced to some extent.
Sessions should not expire.
I don't think there's an easy way for telling if the session expired. But you can try:
$ curl
https://tmate.io/api/t/SESSION_TOKENif the closed_at value is not null, the session has been closed for sure
This won't work in all cases (sessions are not expired on the database side just yet), but that might be a good start.