create subscribe function, created publish function in for server and removed autopublish