Added wait and promise methods for server and client