Secure chat php server implementation and rest api definition