I’m building a decentralized chatting application on react using libp2p but their is an issue I 'm not able to solve.
After creating a node and using dial, I was able to connect to a particular node but when it’s time to exchange messages, every documentation is telling to use the {stream} object returned after connection but when I console.log the connection object their is no stream value in it. so I tried with other streams like _getStream, newStream, streams but none of them contain any write object to write message to peer.
Here is the connection output:
id: "3etfka1676959546838"
remoteAddr: DefaultMultiaddr {bytes: Uint8Array(76), Symbol(@multiformats/js-multiaddr/multiaddr): true}
remotePeer: Ed25519PeerIdImpl {type: 'Ed25519', multihash: Digest, privateKey: undefined, `Preformatted text`publicKey: Uint8Array(36), string: '12D3KooWBVy6M2ndgMPXPNRZxJwodXUvPgZQEgQvQKwqwnV5tcT8'}
stat: {status: 'OPEN', direction: 'outbound', timeline: Proxy, multiplexer: '/mplex/6.7.0', encryption: '/noise'}
tags: []
_close: async () => {…}
_closing: false
_getStreams: () => {…}
_newStream: async (protocols, options = {}) => {…}
streams: Array(2)
Symbol(@libp2p/connection): true
Symbol(Symbol.toStringTag): "Connection"
[[Prototype]]: Object
It would be great if anyone can help.