Giter Club home page Giter Club logo

peer-data's Issues

require is not defined

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? ๐Ÿ˜…

minimal example

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.

type error in example

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 => {
   ~~~~

connectionState missing in types

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'.

Error on PeerDataProvider

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.