Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/johnny-shaman/losand.pvp
WebRTC PvP server and client
https://github.com/johnny-shaman/losand.pvp
Last synced: 20 days ago
JSON representation
WebRTC PvP server and client
- Host: GitHub
- URL: https://github.com/johnny-shaman/losand.pvp
- Owner: johnny-shaman
- License: mit
- Created: 2018-06-11T15:14:06.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-12-22T11:36:19.000Z (about 6 years ago)
- Last Synced: 2024-12-23T11:55:45.762Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 43 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# losand.pvp
## It's a usecase about ...
- [\_(losand).\_](https://www.npmjs.com/package/losand)
- [$(dsand).$()](https://www.npmjs.com/package/dsand)~~~bash
npm i losand.pvp
~~~### import server.js file
~~~javascript
require("losand.pvp")(__dirname + '/public', 'index.html', port, ip);
//port and ip is opthional
~~~### Creat a public folder and make in a index.html
You use it tags
~~~html
_($.role).draw({
pvpCE (channel) {
/* Anything do when connection Established
Channel is WebRTC Data Channel
*/
$(channel).class("hear").on("message");
},
hear (e) {
alert(e.data);
}
})
PvP()()();
~~~~~~bash
node server.js
~~~and access the two clients;
## Usage on BrowserSide PvP function
```javascript
PvP(
// 1st Negotiation info
{
blockedUserList: [],
gameRating: 1000,
friendOnry: true
})(
// 2nd Custom Origin
"https://test.io/"
)(
// 3rd STUN Address or TURNServer Authentication info Object
"stun:l.google...",
{
url: "turn:...",
credential: "...",
username: ""
}
)// $.pvp get's WebRTC DataChannel Object
$.pvp.send("hello");
```