merge socket io and js api