1j01 / jspaint

🎨 Classic MS Paint, REVIVED + ✨Extras
https://jspaint.app/about
MIT License
7.22k stars 562 forks source link

Rewrite multiplayer mode to WebRTC #177

Open not7cd opened 4 years ago

not7cd commented 4 years ago

There are unwanted changes in index.html.

This approach still uses Firebase, but changes its role to only act as signaling. All drawing activities should be handled by WebRTC.

This would mean a major overhaul of how sessions are handled.

Proposed architecture

mesh connection: every client will communicate its local state like cursor position and if its a host

start connection: host establishes stream to every connecting remote to send them the canvas

if host leaves, peers decide which one of them takes host status and host establish new stream to other peers.

for MVP host should be able to edit the canvas, while clients can send changes that are applied by host

not7cd commented 4 years ago

I got basic functionality of sharing cursor position. I will use previous work presented here https://github.com/muaz-khan/Canvas-Designer

not7cd commented 4 years ago

I'm considering dumping FirebaseRTC in favour of socket server based on this repository https://github.com/kolson25/WebRTC-Multi-Peer-Video-Audio

TheAwesome98-Real commented 4 years ago

Multiplayer mode? Have I miss something?