fix deprecated mq api and add keepalive