Communication between the ipfs nodes

I am implementing an electron desktop application with js-ipfs. I want to develop a functionality to communicate with two nodes using the NodeID.
I came across this example where I think the libp2p functions like libp2p.dialProtocol and libp2p.handle can be used to communicate between the nodes.

I tried do this like this

node.libp2p.dialProtocol("element.id.toB58String()", "test-protocol", (err, conn) => { if (err) { throw err } console.log('Dial successful') })

But I am getting

node.libp2p.dialProtocol is not a function

In my case, I wanted to use the libp2p stack using the IPFS instance such as functions like dialProtocol and handle to communicate between the nodes using their nodeID (If that is how it is supposed to be used).

In the IPFS documentation this is mentioned.

libp2p. Every IPFS instance also exposes the libp2p SPEC at ipfs.libp2p. The formal interface for this SPEC hasn’t been defined by you can find documentation at its implementations:

But I could only find the references to start()and stop() method using ipfs.libp2p, not the ones I want to use.
I closely looked inside the IPFS instance to find a way to access libp2p functionality and found that there are some libp2p methods under ipfs._libp2pNode.

I tried to use those also but still facing some issues. I am not sure if it is the proper way to access them.