Socket peer to peer in browser

Hi guys,

We’re working on a multiplayer game and i’m wondering if there’s a way to have both server and client in the game inside the browser, as I’m searching in google and in every example I find, the server is running standalone outside the browser. Is it possible?

Thanks in advance!


I would look for peer to peer. I believe has a peer to peer interface.

good luck

Basically, if you want to have a server on a browser, you’ll have to open up some ports in your router. I don’t know if you want to do that or not. Requiring someone else to do it is a bit much.

Peer to peer connection is possible using WebRTC. It still will require small signalling server that is used to establish connection between peers in order to go around NAT and firewalls.

But tbh, webrtc - is a damn mess. Last time I’ve tried to make a simple app, I failed badly. Maybe I was looking totally in wrong direction, but I found it very frustrating and complicated badly designed API and system around it.

Max, I haven’t tried peer to peer, so I don’t know much about it. I am a happy user of client server. Last time I was looking into it, you could get a free signaling host for low traffic, so hosting shouldn’t be a problem.