begin handshake in js