put common code for server and client in lib folder. fixed multiple notifications in client for the same event