slidevjs / slidev

Presentation Slides for Developers
https://sli.dev
MIT License
33.49k stars 1.37k forks source link

Presenter sync in GitHub pages #855

Closed emersonbottero closed 1 year ago

emersonbottero commented 1 year ago

Is it possible to use remote while I use /presenter in the GitHub page and n given number of people can follow along in the default GitHub page.

Would be one hell of a feature... 😆

tonai commented 1 year ago

For sure that woul be great, but in fact I don't think that remote synchronization is possible without using a server. Event technologies like WebRTC needs to send first some "handshake", from one client to another one, before establishing a peer to peer connetion.

In development the synchronization uses vite-plugin-vue-server-ref that make it possible using your local vite server. But once it is builded and deployed there is no server anymore...

One solution would be to have a fallback to some WebSocket or SSE server for example for server refs. But who will host (and pay for) that server ? In free plan, Sass solutions are limited, so having some kind of central slidev server won't work.

So maybe the only real solution is, for every slidev user, that want remote synchronization in build mode, to deploy their own server.

I created a server I use for one addon I created that adds a poll component to slidev.

It uses WebSocket or Server Sent Events to synchronize the clients, and it works when the slides are statically builded and deployed.

Maybe we can do something that is close to that, in a more generic way (it would be great if it can handle any kind of server ref for example). Something that can be easily deployable and pluggable. In that case using a WebRTC can be interesting because the server will only manage the "handshake" between the clients and the rest of the logic will be managed on the client side.

Now I think there is still some questions:

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

barais commented 2 months ago

@tonai

I just provide an initial draft of an addon for that purpose. It is based on a fork version of your poll component and poll server. If it could be useful to someone else, do not hesitate.

https://github.com/barais/slidev-addon-ws-syncho https://github.com/barais/slidev-slide-synchro-server

It works with github page and the ws server behind nxing proxy and lets encrypt certificate.

Do not hesitate to criticize/comment.

tonai commented 1 month ago

For info I created a PR to centralize the handling of state synchronization here: https://github.com/slidevjs/slidev/pull/1854 Like @barais I created a WS/SSE server and a sync addon that uses that new, not yet published, feature. I also wanted to keep the ability to choose between WS and SSE as you might have troobles to use one or the other in some context.