Jump to content
  • 0

Establish a peer to peer connection, using React Native


kamlekar
 Share

Question

I am trying to establish a peer to peer connection using React Native (Local network, without internet). I see there is a plugin to help me achieve this and also a sample of it here: https://github.com/ant-media/WebRTC-React-Native-SDK/tree/main/samples/peer

But I don't understand why this require a Websocket connection. If I understand correctly, in a P2P connection, a user will behave as server who also initiates the session (peer connection) and the other users will join that session if they have stream info with them.

Also, I tried running the above sample on a physical android device and it is failing with this error:

ERROR Error: INVALID_STATE_ERR

LOG failed to connect to server.com/52.8.126.80 (port 5080) from /10.0.2.16 (port 55750) after 10000ms

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0
On 2/2/2023 at 11:47 PM, kamlekar said:

I am trying to establish a peer to peer connection using React Native (Local network, without internet). I see there is a plugin to help me achieve this and also a sample of it here: https://github.com/ant-media/WebRTC-React-Native-SDK/tree/main/samples/peer

But I don't understand why this require a Websocket connection. If I understand correctly, in a P2P connection, a user will behave as server who also initiates the session (peer connection) and the other users will join that session if they have stream info with them.

Also, I tried running the above sample on a physical android device and it is failing with this error:

ERROR Error: INVALID_STATE_ERR

LOG failed to connect to server.com/52.8.126.80 (port 5080) from /10.0.2.16 (port 55750) after 10000ms

 

Ant media server (and similar products) are all about server assisted WebRTC to bring in reliability and other features that pure p2p cannot offer. If you want pure p2p then you shouldn’t even need ant media server as such. You can always use nodejs or something and a websocket server for exchanging ice and sdp. Am just curious as to why you need pure p2p here 

Edited by Connessione
  • Like 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...