0.1.0 • Published 4 years ago

white_cats.pvp v0.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

white_cats.pvp

white_cats.pvp is a server side messaging example for WebRTC PvP on Websocket

It is a example of white_cats with echoback

Let's try it on Glitch

Usage:

Node.js:

  require('white_cats.pvp')('./public')(8080, '0.0.0.0')

  //require('white_cats.pvp')(public folder path)(port, ip, ...options)

Browser:

    <!-- put a tag into the body tag-->
    <script src="https://cdn.jsdelivr.net/npm/white_cats@0.1.27/cat.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/dsand@0.7.64/dsand.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/dsand@0.7.64/pvp.js"></script>
PvP()()();
//PvP(connection term)(server uri)(ice options)
//if connection establish then...

$.pvp.send('message');

// message event listenning
_($.role).put({
  hear (e) {
    return e.data;
  }
});

_($.pack).put({
  hear (d) {
    console.log(d);
  }
});