Adding function binding to server and detecting server disconnect from client