Showing posts with label WebRTC. Show all posts
Showing posts with label WebRTC. Show all posts

Tuesday, November 25, 2025

webrtc p2p social network prototype working.









Building Decentralized Social Media: A Peer-to-Peer Alternative to Facebook

By John Sowal, presented at the Dojo

The Problem with Centralized Platforms

As someone who's been involved in internet infrastructure since the early days—building some of the earliest CDNs in '92-'94 and working on streaming video—I've watched the evolution of social media with growing concern. The Twitter Files revelations and ongoing issues with Facebook have made one thing clear: we need alternatives to centralized social media platforms.

The core problem is simple but fundamental. As Jack Dorsey pointed out, any company-based platform is vulnerable. The moment you incorporate, governments can issue subpoenas, apply pressure, and force compromises. The result? Increasingly aggressive content moderation that goes far beyond preventing genuine harm.

Real-World Censorship Examples

The filtering has become absurdly disruptive:

  • Getting banned for posting clips from Hollywood movies
  • Facebook jail memes and pins have become so common they're being sold as merchandise
  • Feeds filled with algorithmic content instead of posts from actual friends
  • Legitimate technical content blocked by AI filters (try sharing information about Yasa electric motors—it's blocked because a Turkish politician shares the name)
  • Humor and satire flagged as "false information"

I just want to do what I did with my BBS in 1987—one of the largest in the Bay Area, called Turbo Sysco. Back then, we'd share San Jose Mercury tech articles and discuss them freely. Today, that simple activity feels impossible on Facebook.

The Technical Vision

Can we build something better using modern browser capabilities? The answer is yes. Today's browsers are incredibly powerful:

  • Enormous compute resources: Access to GPU, WebGL, WebGPU
  • Significant storage: Browser-based storage systems
  • WebRTC: Enables mesh networking between peers
  • Flexible data management: Ability to simulate drives, export/import databases

The architecture I envisioned uses relays with WebRTC to establish connections between nodes, creating a truly distributed system where code executes in browser tabs rather than on centralized servers.

Exploring Existing Solutions

Before building from scratch, I surveyed the landscape:

PureJS

Interesting pure JavaScript implementation, but lacked the full feature set needed.

Croquet

Really impressive real-time synchronization. Their demo shows perfect timing across devices—open it on your phone and desktop, and they stay in perfect sync. The platform can run server modules directly in the browser, generating and rendering content while keeping everyone synchronized for gaming and interactive experiences.

The catch? You need an account with them. If the FBI or anyone else wanted to shut you down, they could simply turn off your account. Still centralized.

CYFS

Very interesting—they actually implemented something remarkably close to what I had sketched out independently.

Gun (by Mark Nadal)

I met Mark Nadal at the Dojo about a month ago, and his architecture is exactly what I had sketched out. It uses relays for WebRTC introductions (just like I proposed), but they're simply backups—the real communication happens peer-to-peer. I've been working hard to implement this, though as someone who isn't primarily a Node developer, it's been a brutal learning curve. (ChatGPT has been invaluable for deciphering the alphabet soup of modern web libraries.)

Nostr

The newest entrant, and it shows real promise. Unlike Mastodon's federated approach, Nostr is more censorship-resistant. While relay operators can filter content, your data persists on the protocol indefinitely. There's no central authority that can remove you entirely.

Mastodon vs. Nostr: Federation vs. True Distribution

Mastodon is distributed but federated. My experience showed that you can still get booted from instances for simply publishing links. Because there are people managing these relays, moderation creeps back in.

Nostr, on the other hand, can't be stopped in the same way. Individual relays might filter you, but your data remains on the protocol. As one attendee noted: "there's no filter—it's beautiful."

However, Nostr isn't truly peer-to-peer; everything still goes through relays. Gun's approach is more aligned with pure P2P, using relays only for initial introductions.

My Vision: Radical Transparency Without Interference

Here's my position: I don't even want to encrypt everything. If authorities want to monitor conversations, fine—do it in clear text. What I object to is the interference, the filtering, the fact-checking, the blocked links.

If I'm posting something illegal, let the FBI arrest me. But don't interfere with normal conversation. The bar for censorship has become absurdly low.

I want:

  • A Facebook-like site where I can chat with friends
  • The ability to share links without arbitrary blocking
  • Discussion of news articles without algorithmic interference
  • No "old lady in the middle of the conversation judging everything"

Technical Advantages

A truly peer-to-peer system offers compelling benefits:

  • Zero bandwidth costs: Pull as much data as fast as you want
  • No server fees: No backend infrastructure to maintain
  • Resilience: No central point of failure
  • Static hosting: Code can live on GitHub Pages—free and reliable
  • Rich capabilities: Build virtual worlds, 3D animations, VR experiences, multiplayer interactive content
  • User control: Each person can run their own relay if desired

Addressing Concerns

Q: Won't peer-to-peer put illegal content on my computer?

Ideally, encryption or other mechanisms prevent you from accessing cached content. More importantly, if designed as a caching system, you're only keeping copies of content you've actually viewed—not redistributing material you never looked at.

Q: How will people find each other without indexing?

Through direct sharing of keys, handles, or identifiers. In my case, I have my own domain and can run a relay, making myself discoverable. Users can share their connection information directly with friends.

The Path Forward

We're at a crossroads. The centralized social media experiment has shown its limitations. Censorship, algorithmic manipulation, and corporate vulnerability to government pressure have made these platforms increasingly hostile to free discourse.

The technology exists today to build alternatives. WebRTC, modern browsers, and systems like Gun and Nostr provide the building blocks. What we need is the will to build these systems and the community to adopt them.

The future of social media doesn't have to run through Silicon Valley data centers. It can run in your browser, connecting directly to your friends, with no intermediary deciding what you can say or share.


Interested in learning more about peer-to-peer social networking? Check out these projects:

  • Gun - Decentralized database with P2P sync
  • Nostr - Censorship-resistant social protocol
  • Croquet - Real-time synchronized multiplayer platform
  • CYFS - Decentralized file system

What are your thoughts on decentralized social media? Share your perspective in the comments below.

Wednesday, February 08, 2023

Streamroot’s hybrid webRTC-based P2P video CDN


Streamroot: Powering robust, scalable video delivery for the World Cup
Streamroot uses Google Kubernetes Engine and Google Cloud Load Balancing to handle peaks in traffic for its global peer-accelerated content delivery solution that powers over 20 million video sessions a day with zero downtime.
https://cloud.google.com/customers/streamroot

https://medium.com/lumen-engineering-blog/scaling-up-with-google-kubernetes-engine-our-experience-after-6-months-in-production-ec9e21cd5fce

Hybrid Peer-to-Peer Delivery

A visualization of Streamroot’s hybrid webRTC-based P2P video CDN integrated with JW Player in HTML5.

https://demos.jwplayer.com/peer-accelerated-delivery/
https://github.com/jwplayer/web-player-demos/tree/develop/demos/peer-accelerated-delivery






https://www.linkedin.com/in/paul-louis-ageneau/  wrote a number of webRTC libraries, and also a major developer for streamroot, he's now with netflix.  




Saturday, April 16, 2022

Scalable WebRTC peer-to-peer broadcasting

 https://github.com/muaz-khan/WebRTC-Scalable-Broadcast



WebRTC Scalable Broadcast

Scalable WebRTC peer-to-peer broadcasting demo.

npm downloads

This module simply initializes socket.io and configures it in a way that single broadcast can be relayed over unlimited users without any bandwidth/CPU usage issues. Everything happens peer-to-peer!

RTCMultiConnection v3 and Scalable Broadcast

RTCMultiConnection v3 now naively supports scalable-broadcast:

DemoTitleTestLiveViewSource
Scalable Audio/Video BroadcastDemoSource
Scalable Screen BroadcastDemoSource
Scalable Video BroadcastDemoSource
Scalable File SharingDemoSource

Demos

Note: These (below) are old demos. Above (RTCMultiConnection-v3) demos are preferred (and up-to-dated).

  1. index.html - share video or screen or audio over unlimited users using p2p methods.
  2. share-files.html - share files with unlimited users using p2p methods!

Browsers Support:

BrowserSupport
FirefoxStable / Aurora / Nightly
Google ChromeStable / Canary / Beta / Dev

Browsers Comparison

host means the browser that is used to forward remote-stream.

HostStreamsReceiversIssues
ChromeAudio+VideoChrome,FirefoxRemote audio tracks are skipped.
ChromeAudioNoneChrome can NOT forward remote-audio
ChromeVideoChrome,FirefoxNo issues
ChromeScreenChrome,FirefoxNo issues
FirefoxAudio+VideoChrome,FirefoxNo issues
FirefoxAudio+ScreenChrome,FirefoxNo issues
FirefoxAudioChrome,FirefoxNo issues
FirefoxVideoChrome,FirefoxNo issues
FirefoxScreenChrome,FirefoxNo issues
  1. First column shows browser name
  2. Second column shows type of remote-stream forwarded
  3. Third column shows browsers that can receive the remote forwarded stream
  4. Fourth column shows sender's i.e. host's issues

Chrome-to-Firefox interoperability also works!

Android devices are NOT tested yet. Opera is also NOT tested yet (though Opera uses same chromium code-base).

Currently you can't share audio in Chrome out of this big. In case of audio+video stream, chrome will skip remote-audio tracks forwarding. However chrome will keep receiving remote-audio from Firefox!

Firefox

Firefox additionally allows remote-stream-forwarding for:

  1. Streams captured from <canvas>
  2. Streams captured from <video>
  3. Streams captured or generated by AudioContext i.e. WebAudio API

Is stream keeps quality?

Obviously "nope". It will have minor side-effects (e.g. latency in milliseconds/etc.).

If you'll be testing across tabs on the same system, then you'll obviously notice quality lost; however it will NOT happen if you test across different systems.

WebRTC Scalable Broadcast

In the image, you can see that each NEW-peer is getting stream from most-recent peer instead of getting stream directly from the moderator.

npm install webrtc-scalable-broadcast

Now, goto node_modules>webrtc-scalable-broadcast:

cd node_modules
cd webrtc-scalable-broadcast

# and run the server.js file
node server.js

Or:

cd ./node_modules/webrtc-scalable-broadcast/
node ./server.js

Or install using WGet:

mkdir webrtc-scalable-broadcast && cd webrtc-scalable-broadcast
wget http://dl.webrtc-experiment.com/webrtc-scalable-broadcast.tar.gz
tar -zxvf webrtc-scalable-broadcast.tar.gz
ls -a
node server.js

Or directly download the TAR/archive on windows:

And now open: http://localhost:8888 or 127.0.0.1:8888.

If server.js fails to run:

# if fails,
lsof -n -i4TCP:8888 | grep LISTEN
kill process-ID

# and try again
node server.js

How it works?

Above image showing terminal logs explains it better.

For more details, to understand how this broadcasting technique works:

WebRTC Scalable Broadcast

Assuming peers 1-to-10:

First Peer:

Peer1 is the only peer that invokes getUserMedia. Rest of the peers will simply forward/relay remote stream.

peer1 captures user-media
peer1 starts the room

Second Peer:

peer2 joins the room
peer2 gets remote stream from peer1
peer2 opens a "parallel" broadcasting peer named as "peer2-broadcaster"

Third Peer:

peer3 joins the room
peer3 gets remote stream from peer2
peer3 opens a "parallel" broadcasting peer named as "peer3-broadcaster"

Fourth Peer:

peer4 joins the room
peer4 gets remote stream from peer3
peer4 opens a "parallel" broadcasting peer named as "peer4-broadcaster"

Fifth Peer:

peer5 joins the room
peer5 gets remote stream from peer4
peer5 opens a "parallel" broadcasting peer named as "peer5-broadcaster"

and 10th peer:

peer10 joins the room
peer10 gets remote stream from peer9
peer10 opens a "parallel" broadcasting peer named as "peer10-broadcaster"

Conclusion

  1. Peer9 gets remote stream from peer8
  2. Peer15 gets remote stream from peer14
  3. Peer50 gets remote stream from peer49

and so on.

License

Scalable WebRTC Broadcasting Demo is released under MIT licence . Copyright (c) Muaz Khan.

Friday, July 24, 2020

Free STUN, WebRTC, Web Socket Servers, Storage and Media Processing


found on: https://free-for.dev/

videoinu — Create and edit screen recordings and other videos online

Google Meet — Use Google Meet for your business's online video meeting needs. Meet provides secure, easy-to-join online meetings.

meet.jit.si — One click video conversations, screen sharing, for free

riot.im — A decentralized communication tool built on Matrix. Group chats, direct messaging, encrypted file transfers, voice and video chats, and easy integration with other services.


talky.io — Free group video chat. Anonymous. Peer‑to‑peer. No plugins, signup, or payment required

whereby.com — One click video conversations, for free (formerly known as appear.in)

wistia.com — Video hosting with viewer analytics, HD video delivery and marketing tools to help understand your visitors, 25 videos and Wistia branded player

yammer.com — Private social network standalone or for MS Office 365. Free with a bit less admin tools and user management features

zoom.us — Secure Video and Web conferencing, add-ons available. Free limited to 40 minut

STUN, WebRTC, Web Socket Servers and Other Routers

conveyor.cloud — Visual Studio extension to expose IIS Express to the local network or over a tunnel to a public URL.
Hamachi — LogMeIn Hamachi is a hosted VPN service that lets you securely extend LAN-like networks to distributed teams with free plan allows unlimited networks with up to 5 peoples
Radmin VPN - Connect multiple computers together via a VPN enabling LAN-like networks. Unlimited peers. (Hamachi alternative)
localhost.run — Instantly share your localhost environment! No download required. Run your app on port 8080 and then run this command and share the URL.
ngrok.com — Expose locally running servers over a tunnel to a public URL.
segment.com — Hub to translate and route events to other third-party services. 100,000 events/month free
serveo.net — Quickly expose any local port to the public internet on a servo subdomain using an SSH tunnel, includes SSH GUI to replay requests over HTTP.
stun:global.stun.twilio.com:3478?transport=udp — Twilio STUN
stun:stun.l.google.com:19302 — Google STUN
webhookrelay.com — Manage, debug, fan-out and proxy all your webhooks to public or internal (ie: localhost) destinations. Also, expose servers running in a private network over a tunnel by getting a public HTTP endpoint (https://yoursubdomain.webrelay.io <----> http://localhost:8080).
ZeroTier — FOSS managed virtual Ethernet as a service. Unlimited end-to-end encrypted networks of 100 clients on free plan. Clients for desktop/mobile/NA; web interface for configuration of custom routing rules and approval of new client nodes on private networks.

Storage and Media Processing
sirv.com — Smart Image CDN with on-the-fly image optimization and resizing. Free tier includes 500 MB of storage and 2 GB bandwidth.

image4.io — Image upload, powerful manipulations, storage and delivery for websites and apps, with SDK's, integrations and migration tools. Free tier includes 25 credits. 1 credit is equal to 1 GB of CDN usage, 1GB of storage or 1000 image transformations.
cloudimage.com — Full image optimization and CDN service with 1500+ Points of Presence around the world. A variety of image resizing, compression, watermarking functions. Open source plugins for responsive images, 360 image making and image editing. Free monthly plan with 25GB of CDN traffic and 25GB of cache storage and unlimited transformations.
cloudinary.com — Image upload, powerful manipulations, storage and delivery for sites and apps, with libraries for Ruby, Python, Java, PHP, Objective-C and more. Perpetual free tier includes 7,500 images/month, 2 GB storage, 5 GB bandwidth
easyDB.io — one-click, hosted database provider. They provide a database for the programming language of your choice for development purposes. The DB is ephemeral and will be deleted after 24 or 72 hours on the free tier.
embed.ly — Provides APIs for embedding media in a webpage, responsive image scaling, extracting elements from a webpage. Free for up to 5,000 URLs/month at 15 requests/second
filestack.com — File picker, transform and deliver, free for 250 files, 500 transformations and 3 GB bandwidth
gumlet.com — Image resize-as-a-service. It also optimizes images and performs delivery via CDN. Free tier includes 1 GB bandwidth and unlimited number of image processing every month for 1 year.
image-charts.com — Unlimited image chart generation with a watermark
jsonbin.io — Free JSON data storage service, ideal for small-scale web apps, website, mobile apps.
kraken.io — Image optimization for website performance as a service, free plan up to 1 MB file size
npoint.io — JSON store with collaborative schema editing
otixo.com — Encrypt, share, copy and move all your cloud storage files from one place. Basic plan provides unlimited files transfer with 250 MB max. file size and allows 5 encrypted files
packagecloud.io — Hosted Package Repositories for YUM, APT, RubyGem and PyPI. Limited free plans, open source plans available via request
piio.co — Responsive image optimization and delivery for every website. Free plan for developers and personal websites. Includes free CDN, WebP and Lazy Loading out of the box.
placeholder.com — A quick and simple image placeholder service
placekitten.com — A quick and simple service for getting pictures of kittens for use as placeholders
plot.ly — Graph and share your data. Free tier includes unlimited public files and 10 private files
podio.com — You can use Podio with a team of up to five people and try out the features of the Basic Plan, except user management
QuickChart — Generate embeddable image charts, graphs, and QR codes
redbooth.com — P2P file syncing, free for up to 2 users
shrinkray.io — Free image optimization of GitHub repos
tinypng.com — API to compress and resize PNG and JPEG images, offers 500 compressions for free each month
transloadit.com — Handles file uploads and encoding of video, audio, images, documents. Free for Open source, charities, and students via the GitHub Student Developer Pack. Commercial applications get 2 GB free for test driving