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

any basic simple working example? #45

Open
boynet opened this issue May 19, 2015 · 9 comments
Open

any basic simple working example? #45

boynet opened this issue May 19, 2015 · 9 comments
Assignees

Comments

@boynet
Copy link

boynet commented May 19, 2015

just cant get it to work..

this:

var quickconnect = require('rtc-quickconnect');

give me (do I need to include require.js? there is no info about it but I assume that I should)

Uncaught Error: Module name "rtc-quickconnect" has not been loaded yet for context: _. Use require([])

than I tried to look at the example which didnt work

<script>
quickconnect('https://switchboard.rtc.io/', { room: 'bundle-test' })
  // tell quickconnect we want a datachannel called test
  .createDataChannel('test')
  // when the test channel is open, let us know
  .on('test:open', function(id, dc) {
    dc.onmessage = function(evt) {
      console.log('peer ' + id + ' says: ' + evt.data);
    };
    console.log('test dc open for peer: ' + id);
    dc.send('hi');
  });
</script>

it just return quickconnect is undefind.
what I am missing?

@Neograph734
Copy link

I ran it through npm browserify. place both code fragments in one .js file. Browserify it. Requirejs is not required and alle dependencies are loaded in one includable file. See specific documentation on browserify npm page.

@DamonOehlman
Copy link
Member

Also see beefy which is what I use to run local examples. I should also investigate adding a "Run on requirebin" badge that would let you run the example up on requirebin really easily...

@celevra
Copy link

celevra commented Jun 8, 2015

+1 for not using browserify, i have an allready running application and now i'm forced to use browserify which got an complete other concept as simple include an library via html script tag.
but as mentioned i don't want to rewrite my allready existing application or mix different concepts, so now i'm forced to use a library such as peer.js (and i really don't want to use peer.js)

@kumavis
Copy link
Contributor

kumavis commented Jun 8, 2015

Suppose you could provide a UMD build with browserify --standalone. Could put them on github releases if you dont want them in version control.

DamonOehlman added a commit that referenced this issue Jun 8, 2015
@DamonOehlman
Copy link
Member

Hey All - I'm not too precious about providing a UMD build for rtc-quickconnect as it does sound like that's what people are after. Also, a grunt build script was contributed earlier on in quickconnect's life but the problem is I keep forgetting to run it and keep the dist up to date.

I'll see if I can put a process in place where we ensure this example is kept up to date, and also that new examples cater for usage in a non commonJS environment also.

@DamonOehlman
Copy link
Member

Also out of interest keen to know what tool chains people are using?

@kumavis
Copy link
Contributor

kumavis commented Jun 9, 2015

still browserify + beefy, usually not happy when i have to mess with gulp

@kumavis
Copy link
Contributor

kumavis commented Jun 9, 2015

i havent tried it but this might work-- has a cli so you can just use an npm script and specify assets
https://github.com/ngoldman/gh-release

browserify index.js --standalone -o build.js && gh-release [...] --assets build.js && rm build.js

@DamonOehlman
Copy link
Member

@kumavis Just having a look at this again now, that's super good advice. I should definitely have a look into this. Capturing this in a prepublish script is probably a good idea so it's not forgotten might be a good idea also.

Will investigate.

@DamonOehlman DamonOehlman self-assigned this Jul 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants