Coder Social home page Coder Social logo

webrtc-zero-downtime-restart's Introduction

webrtc-zero-downtime-restart

webrtc-zero-downtime-restart is a simple Pion WebRTC broadcast server that can be restarted without disconnecting users. All the WebRTC state is suspended to disk. The next time the process is started that information is read into memory. All the remote PeerConnections will be unaware that they are even connected to a new process. This gives us the following benefits.

Painless Deploys

No more migrating users to a new process when you want to deploy code. At anytime you can replace the binary you are running and no users will be impacted. You don't need to implement extra signaling/error handling for your deploy process.

Easier Scaling

Move clients to an entirely different host without them knowing. You can do this with zero interruption in service or additional signaling.

Greater Resiliency

Since server state is constantly being written to disk you don't need to worry about crashes anymore. If you server goes down (and then restarts) it will automatically resume the last known good state.

Running

Execute go run github.com/Sean-Der/webrtc-zero-downtime-restart@latest.

This will start the server. On startup the server will print.

Open http://localhost:8080 to access this demo

You can then access it at http://localhost:8080. The first user to connect will broadcast their webcam. Every user after can watch the broadcasted video.

At anytime you can start+stop the process in your terminal. Users will not be disconnected and will be able to continue talking when the process is started again.

What is next

This demo uses reflection to access internal Pion WebRTC APIs. We will be working on designing the final APIs for the next major release of Pion WebRTC. We would love your feedback ideas either on the repo or Slack

webrtc-zero-downtime-restart's People

Contributors

sean-der avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webrtc-zero-downtime-restart's Issues

Breaks forward privacy

If I read this code correctly, it is persisting the whole dtls.State. If I understand this correctly, the it is persistig the session key, which breaks forward secrecy.

Would it not be better to just persist the certificate, and renegotiate at reconnect? This would cost just one round-trip, without breaking forward secrecy.

At any rate, I recommend having this idea reviewed by a competent cryptographer.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.