Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to have a simpler example here? #35

Open
HyperClockUp opened this issue Sep 27, 2020 · 4 comments
Open

Is it possible to have a simpler example here? #35

HyperClockUp opened this issue Sep 27, 2020 · 4 comments
Labels

Comments

@HyperClockUp
Copy link

All examlpes here confuse me a lot. Too many encapsulations or requires in those examples, so if there is a no-extra-dependency example or just an example that import modules from node_modules directory, will be helpful to me!

Thanks!

@HyperClockUp HyperClockUp changed the title Is it possible to have a simpler examlpe here? Is it possible to have a simpler example here? Sep 27, 2020
@markandrus
Copy link
Member

There have been a few requests for "simpler" examples; however, I'm not sure what people actually want. An RTCDataChannel example? See the ping-pong example. An audio/video example? See the audio-video-loopback example.

These examples — and all the other examples — have been structured so that you can focus on experimenting with node-webrtc's APIs without having to worry about exchanging WebRTC offers and answers. Because exchanging WebRTC offers and answers is one of the most boilerplate-y, annoying bits of WebRTC — and everyone does it differently! E.g., by

  • Using SIP
  • Using JSON over WebSocket
  • Using HTTP
  • Copying/pasting (quickly!)

Since this project is not interested in prescribing a way to exchange WebRTC offers and answers, all that code is isolated to the lib/ folder. Instead, we focus on ways to use node-webrtc (since this is, after all, node-webrtc-examples). To this end, the examples have been written so that you don't have to worry about WebRTC offer and answer exchange. You just need to fulfill two functions: one for the client (beforeAnswer) and one for the server (beforeOffer).

This model makes it really easy to add more and more examples. We have 8 or 9 ATM, depending on how you count.

Perhaps what I have not made easy is

  • Understanding how to add new examples — maybe we just need to better document in the README.md.
  • Forking this repo and building an application on top of it — I'm not sure if people want/expect this, but I'm pretty uninterested in this.
  • Understanding how to use the standard WebRTC APIs themselves — This is also not the point of this project, since there are also plenty of WebRTC tutorials out there and, with the exception of a few nonstandard additions and omissions, node-webrtc is providing the standard WebRTC APIs.

Anyway, perhaps I am speculating… but I'm also writing this for anyone else reading who is curious about this.


I should return to your question: what would you like to see?

@mrbar42
Copy link

mrbar42 commented Jun 16, 2021

It's been a while since this discussion took place, but i think what people mean by "simpler" is - that it wouldn't be a full project. I'm looking for it too.

The examples are very good for learning and showcasing different capabilities and different use cases, but once i've learned, they are no longer beneficial since they rely on so much abstraction.
in order to use any of the examples i'll have to use the entire examples project as a boilerplate which is unwanted, i prefer to incorporate it into my existing project.

The missing piece is an example with a single server file and a single client js file, no requiring other local files on either and no browserify and so on - standalone.
this could be phrased as the minimal code required for ping pong/audio echo/etc.

will there be duplication? yes, and that's a good thing because standalone examples are very powerful.

@ghost
Copy link

ghost commented Jul 27, 2021

@mrbar42

The missing piece is an example with a single server file and a single client js file, no requiring other local files on either and no browserify and so on - standalone.
this could be phrased as the minimal code required for ping pong/audio echo/etc.

will there be duplication? yes, and that's a good thing because standalone examples are very powerful.

Any updates on the matter?

@mwolfeu
Copy link

mwolfeu commented Sep 18, 2023

Bump. Single files are the way to get started. They are not meant to be efficient, but rather circumscribe all the concepts we have to assimilate in one file. The layers of abstraction just hinder this. Ex: Simple-peer has examples where you have to exchange the offers by copying/pasting JSON. They were dead simple and very clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants