3

I'm looking for a method to connect client(web browser) to server(without external IP) using p2p.

As client-side language i would like to use javascript.

I was reading about WebRTC Peer-to-peer but i don't know if it only works with two clients(javascript) or if i can use some other language ( PHP, Python, Node.js ).

I know about signaling, STUN and TURN servers. I have server with external IP address so it won't be a problem.

My question is what programming language can i use on the server?

HealV
  • 69
  • 5
  • How about use websocket? there's a very good library in JS called socket.io... WebRTC is more used for vídeo and audio p2p. What's your goal with that? maybe websocket solve your problem – Milton Filho Nov 11 '18 at 22:29
  • My goal is only to send and receive data in text format. – HealV Nov 12 '18 at 08:05

3 Answers3

2

Actualy you can avoid other languages if you will use Kurento media server. It have javascript like native. And it frendly desiged to use it with Node.js backend.

Also Janus-Gateawey have commodious JavaScript API and allows build backend on any language you want. Managing all webRTC things happens on client side. That very cose if you understand webRTC and JS at least on basical level.

For control webRTC from back side on python you can use aiortc library

If you need to send/receive only text data then socket.io with e.g. python-socket.io (on server side) is that what you need

Andrey Topoleov
  • 1,591
  • 15
  • 20
1

I added to Andrey Suglobov's answer: The client does not receive the WebRTC packets from the server because it doesn't have an external IP. In order to solve this problem, you have to configure it to communicate via the TURN server in the middle.

[WebRTC server] ↔ [TURN] ↔ [NAT] ↔ [client]

Generally, the client uses JavaScript because it's a browser. But WebRTC is a specification that supports P2P on the web. If supporting this specification, it does not matter what programming language you use.

Thank you.

AirenSoft
  • 81
  • 4
0

Probably found an answer. I can use javascript server side in node.js

HealV
  • 69
  • 5