vardius / peer-data Goto Github PK
View Code? Open in Web Editor NEWLibrary for files, media streaming/sharing using WebRTC
Home Page: https://rafallorenz.com/peer-data
License: MIT License
Library for files, media streaming/sharing using WebRTC
Home Page: https://rafallorenz.com/peer-data
License: MIT License
I'm not sure, if the npm package is supposed to be usable as JavaScript module, but if I use
<script type="module" src="node_modules/peer-data/dist/index.es.js"></script>
I get
Uncaught ReferenceError: require is not definedat SocketChannel.ts:5
Is this a bug or do I misunderstand how index.es.js
is supposed to be used? ๐
I'd really appreciate a minimal running example how to send data P2P using peer-data
and peer-data-server
libraries (basic use case). The README.md mentions how to use the library with different frame works. The website shows an example without explanation what it does or what to expect: Should I get output on the console if I open the page twice? The same applies to the Basic Example in the documentation.
shows 404 not found
The example on the website
import PeerData, { EventDispatcher, SocketChannel } from 'peer-data';
const servers = {
iceServers: [
{url: "stun:stun.1.google.com:19302"}
]
};
const dispatcher = new EventDispatcher();
const peerData = new PeerData(dispatcher, servers);
const signaling = new SocketChannel(dispatcher, 'http://localhost:8080');
room.on("participant", participant => {
participant.on("message", payload => console.log("message", payload));
participant.send('Hi mate! this is private message.');
})
compiles with errors in TypeScript 3.9.3
src/index.ts:10:43 - error TS2345: Argument of type '{ iceServers: { url: string; }[]; }' is not assignable to parameter of type 'RTCConfiguration'.
Types of property 'iceServers' are incompatible.
Type '{ url: string; }[]' is not assignable to type 'RTCIceServer[]'.
Property 'urls' is missing in type '{ url: string; }' but required in type 'RTCIceServer'.
10 const peerData = new PeerData(dispatcher, servers);
~~~~~~~
node_modules/typescript/lib/lib.dom.d.ts:1291:5
1291 urls: string | string[];
~~~~
'urls' is declared here.
src/index.ts:13:1 - error TS2304: Cannot find name 'room'.
13 room.on("participant", participant => {
~~~~
WebRTC types does not have connectionState
property defined on RTCPeerConnection
object.
Need to find solution to fix it, or w8 for types update.
semantic error TS2339 Property 'connectionState' does not exist on type 'RTCPeerConnection'.
Hi Vardius,
Great package!
I'm using the "PeerDataProvider" , just as described in React Chat demo. It's working fine on Localhost, but when hosted in Azure I get the error:
react_devtools_backend.js:6 TypeError: Cannot read property 'register' of undefined
at new (SocketChannel.ts:13)
at useSignaling.tsx:10
at o (PeerDataProvider.tsx:14)
at qc (react-dom.production.min.js:153)
at mo (react-dom.production.min.js:261)
at fs (react-dom.production.min.js:246)
at os (react-dom.production.min.js:246)
at Jo (react-dom.production.min.js:239)
at react-dom.production.min.js:123
at t.unstable_runWithPriority (scheduler.production.min.js:19)
This is the code of the Provider:
<PeerDataProvider
servers={{
iceServers: [
{
urls: ["stun:stun.1.google.com:19302", "stun:74.125.142.127:19302"],
},
{
urls: "turn:turn.bistri.com:80",
credential: "homeo",
username: "homeo",
},
],
}}
constraints={{ ordered: true }}
signaling={{
url:
process.env.REACT_APP_PROXY_SERVER, //https://mecureserver.azurewebsites.net/ (Using peer-server)
}}
>
What I'm missing ?
Kid regards,
Paul
If channel state is not open and we try to send data it throws error
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.