add mqtt spec, fix bugs