MODE-2251: Add refresh session method and improve message handling