Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/johnny-shaman/cte.pvp.like
cte.p2p a use case on cte by WebRTC
https://github.com/johnny-shaman/cte.pvp.like
Last synced: 15 days ago
JSON representation
cte.p2p a use case on cte by WebRTC
- Host: GitHub
- URL: https://github.com/johnny-shaman/cte.pvp.like
- Owner: johnny-shaman
- License: mit
- Created: 2019-03-14T02:46:23.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-17T12:57:00.000Z (almost 6 years ago)
- Last Synced: 2024-11-22T20:37:18.993Z (3 months ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cte.pvp
## It's a usecase about ...
- [Category Theory Environment](https://www.npmjs.com/package/cte)
- [$(dsand).$()](https://www.npmjs.com/package/dsand)~~~bash
npm i cte.pvp.like
~~~### server example
~~~javascript
const http = require("http");
const express = require("express");
const app = express();
const sv = http.createServer(app);
require("cte.pvp.like")(sv).listen(process.env.PORT, process.env.IP);
~~~### Creat a public folder and make in a index.html
You use it tags
~~~html
_($.role).put({
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
{
url: "stun:l.google..."
},
{
url: "turn:...",
credential: "...",
username: ""
}
)// $.pvp get's WebRTC DataChannel Object
$.pvp.send("hello");
~~~