libp2p / js-libp2p-webrtc-star

libp2p WebRTC transport that includes a discovery mechanism provided by the signalling-star
https://libp2p.io
Other
320 stars 96 forks source link

how can i get the source peer-id when createListener #388

Closed nrz123 closed 2 years ago

nrz123 commented 2 years ago

when i use this code: const ws=new WStar({ upgrader:{ upgradeInbound: maConn => maConn, upgradeOutbound: maConn => maConn, localPeer } }) ws.createListener(socket => { //how get peer-id? console.log(socket) }) how can i get the source peer-id?

vasco-santos commented 2 years ago

Hello @nrz123

What is the use case for this? Until the socket is upgraded into a libp2p connection you can't access the peer Id

nrz123 commented 2 years ago

i could not upgraded into libp2p-connection because i don't know remotePeer when i createListener i want to know who dial to me but when i console.log(maConn.remoteAddr) is undefined

mpetrunic commented 2 years ago

@nrz123 is this still happening?

wemeetagain commented 2 years ago

closing due to lack of response. feel free to reopen if this is still an issue