Code Monkey home page Code Monkey logo

offline-browser-communication's Introduction

Pion WebRTC
Offline Browser Sync

WebRTC without a signaling server!

Pion webrtc Slack Widget
License: MIT


This repo demonstrates how you can connect two WebRTC proccesses without signaling. No configuration is needed ahead of time, so no hardcoding of IP Addresses. The peers use mDNS to connect to each other, and have pre-set ICE Credentials and DTLS Certificates.

Running

  • git clone https://github.com/pion/offline-browser-communication.git
  • cd offline-browser-communication
  • go run *.go
  • Open https://jsfiddle.net/nah7qvkj/

You should see the following in your terminal.

Ready to connect, please load https://jsfiddle.net/nah7qvkj/
Connection State has changed checking
Connection State has changed connected
DataChannel foo has opened

If everything worked you can now send messages from your browser to your terminal!

What this means

This means you can have two devices connect without any setup. No need to setup a server, or native apps with more control.

You could build stuff like.

  • Sync data between two PWA without a backend
  • Have a multiplayer game that never leaves your network
  • Build a conferencing/chat app that doesn't require any setup
  • Please share your cool ideas with us!

FAQ

Is this secure?

No currently everything is hardcoded, this is just a demonstration. I believe this could be reasonably secure if seeded properly. Better to ask a security person though.

What platforms are supported?

OSX and Linux

What browsers work?

Only Chromium so far. If there is interest I would like to support more

What libraries/dependencies does this use

Only Pion WebRTC it is a full Go implementation of WebRTC. It has zero C/C++ usage.

What is next?

I would like to get this into the IETF/W3C, but as an individual I am unable to be involved. If you are interested and have membership please reach out!

I want to talk about cool WebRTC stuff!

Join the Pion Slack

I need to update the DTLS Fingerprint

If you see an error like InvalidAccessError: x509Cert expired the certificate has expired. You can update it by following these instructions. Please submit a PR with the updated certificate as well, thanks!

  // Create new certificate
  go run `go env GOROOT`/src/crypto/tls/generate_cert.go --host=localhost --ecdsa-curve=P256

  // Create new fingerprint for jsfiddle
  openssl x509 -noout -fingerprint -sha256 -inform pem -in cert.pem

Community

Pion has an active community on the Golang Slack. Sign up and join the #pion channel for discussions and support. You can also use Pion mailing list.

We are always looking to support your projects. Please reach out if you have something to build!

If you need commercial support or don't want to use public methods you can contact us at [email protected]

License

MIT License - see LICENSE for full text

offline-browser-communication's People

Contributors

renovate-bot avatar renovate[bot] avatar 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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

offline-browser-communication's Issues

Could this work with just the browser from p2p?

I just discovered that there is a way to generate certificates that you can generate in the browser using RTCPeerConnection.generateCertificate

it's also possible to store this cert in indexedDB. and construct a peer connection using new RTCPeerConnection({certificates})

i have no understanding of why you would want to create your own certificates and store it in the indexedDB... haven't find any article/demo of someone who are using it of how and why you want to use own certificates

is it so you could create some kind of “reusable offer/answer”?

Dependency Dashboard

This issue provides visibility into Renovate updates and their statuses. Learn more

This repository currently has no open or pending branches.


  • Check this box to trigger a request for Renovate to run again on this repository

Getting Error when downloading packages

image

When trying to run the the app I receive this error

What are my doing wrong

By the way on Windows I couldn't use go run *go , I had to use go run . instead

Connection fails after updating the cert and the SHA256 fingerprint

I wanted to reinvestigate this amazing repo and update the certificate but I could not get it to work.
Perhaps I am doing something wrong...

Here are the steps I've done:

  1. After getting the InvalidAccessError: x509Cert expired, ran:
  // Create new certificate
  go run `go env GOROOT`/src/crypto/tls/generate_cert.go --host=localhost --ecdsa-curve=P256

  // Create new fingerprint for jsfiddle
  openssl x509 -noout -fingerprint -sha256 -inform pem -in cert.pem
  1. Ran go run *.go
  2. Opened the jsfiddle link and replaced the SHA256 fingerprint in const answer for the one I got in the Terminal.
  3. Saved and reran the jsfiddle.

But I still got the following error in the browser console:
"<a class='gotoLine' href='#98:15'>98:15</a> Uncaught InvalidStateError: Failed to execute 'send' on 'RTCDataChannel': RTCDataChannel.readyState is not 'open'"

Error when trying to run script.

I am trying to run the script and after downloading the dependencies, the terminal throws me this error:

`panic: InvalidAccessError: x509Cert expired

goroutine 1 [running]:
main.panicIfErr(...)
/Users/-/Desktop/offline-browser-communication-master/server.go:110
main.main()
/Users/-/Desktop/offline-browser-communication-master/server.go:50 +0x3b2
exit status 2
`

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.