peer.js | A multipeer WebRTC client | Chat library

 by   MrSwitch JavaScript Version: Current License: No License

kandi X-RAY | peer.js Summary

kandi X-RAY | peer.js Summary

peer.js is a JavaScript library typically used in Telecommunications, Media, Telecom, Messaging, Chat, Nodejs applications. peer.js has no bugs, it has no vulnerabilities and it has low support. You can download it from GitHub.

A multipeer WebRTC client
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              peer.js has a low active ecosystem.
              It has 29 star(s) with 11 fork(s). There are 8 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              peer.js has no issues reported. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of peer.js is current.

            kandi-Quality Quality

              peer.js has 0 bugs and 0 code smells.

            kandi-Security Security

              peer.js has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              peer.js code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              peer.js does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              peer.js releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.
              peer.js saves you 334 person hours of effort in developing the same functionality from scratch.
              It has 800 lines of code, 0 functions and 11 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of peer.js
            Get all kandi verified functions for this library.

            peer.js Key Features

            No Key Features are available at this moment for peer.js.

            peer.js Examples and Code Snippets

            No Code Snippets are available at this moment for peer.js.

            Community Discussions

            QUESTION

            Updating the game state in a multiplayer game
            Asked 2021-Feb-14 at 02:19

            I am working on a multiplayer game. Each client have a character that moves in a shared environment.
            I use socket.io to create rooms and peer.js to create a peer-to-peer connection between clients.
            What I am trying to do is to enable each client to update the positions of the characters of the other players in his map.
            For that, each client should have the state of the keyboard cursors (arrow keys) of the other players so that he can move their corresponding characters with a walking animation.

            P2P: I am thinking of creating duplex streams between the clients so that each client will have the state of the keyboard cursors of the other players, so that he can move their characters with the appropriate animation...
            SOCKETS: I can also pass the information via the server using sockets, but i will have to send an update of the cursors state 60 times per second since the game is on 60 fps, which makes a lot of socket messages. I am not sure this is the most efficient way to handle it

            What is the most efficient way to keep everybody updated about the state of the other players ? Any suggestion will be appreciated. Thanks.

            ...

            ANSWER

            Answered 2021-Feb-14 at 02:19

            Actually your game is likely a little demo of a MMORPG game or something like CS/CSGO.

            For such a game, we always have a loop in main process (work process) with a frequency like several frames a second(say 20 frame). In every frame, the client will process the packets received from others and the options form the pleyer.

            If here is 20 frames, that means every fram can't be more than 50ms, so it will cause some delay if it's in WLAN and some packets drop happend.

            If you want to use P2P to synchronized players action, here is a problem: when player number booms, the comlicated of the connection boos too. What's more, you need a reliable connection protocol, that means you need to know how to use something like QUIC or write a reliable UDP by yourself.

            So I think the most effcient way may keep use C/S model insetead of P2P only if your game will use in LAN and there is quite a few players.

            Source https://stackoverflow.com/questions/66191525

            QUESTION

            Error when instantiating a node chaincode on a channel
            Asked 2020-Sep-09 at 08:57

            I'm trying to instantiate an already installed node chaincode on a channel, but it fails with error: failed to invoke chaincode name:"lscc" , error: container exited with 0

            What I did up to this point:

            1. Successfully started a network with 2 organizations with 2 peers for each organization and a raft consensus using ./byfn up -c some-channel -s couchdb -o etcdraft -l node script from Building your first network (v1.4) tutorial. The network already has one instantiated chaincode named mycc.
            2. Connected to the network from my script using Node.js SDK. I am able to successfully invoke read and write chaincode methods of the mycc chaincode from my script.
            3. Installed new chaincode on all 4 peers using each organization's admin identities. I am able to confirm that the chaincode is indeed installed by querying installed chaincodes on a peer. Also peer container logs also confirm that the chaincode is installed successfully.
            4. Tried to instantiate the installed chaincode and encountered the above-mentioned error.

            Here is how I'm trying to instantiate my chaincode:

            ...

            ANSWER

            Answered 2020-Sep-08 at 22:56

            My suggestion is that you have to use two different channels for two different chaincodes. You can install as much chaincode as you want in every peer but the problems will begin when you try to instantiate chaincode as this process is directly involved with network and channel. Though they change the instantiate process from version >= 2.

            For the records:

            For running a business, some organizations have to come into a consensus and so they have to create a channel where only permissioned organizational properties have access.

            Here within a channel every valid organizational peer hold a physical copy of business transactional records which is known as ledger where the ledger is identical which means every ledger that belongs to same channel must hold the same records.

            A ledger consists of two distinct, though related, parts – a world state and a blockchain. The world state – a database that holds current values of a set of ledger states. The blockchain – a transaction log that records all the changes that have resulted in the current the world state.

            A chaincode is the business logic that is used to read the records of ledger or to write new records into the ledger or to update existing records.

            A chaincode is consist with multiple smart contracts.

            So The convention is for each channel, you need an identical chaincode. If you have 2 channel, than it's the convention that you have two different chaincodes.

            Source https://stackoverflow.com/questions/63793936

            QUESTION

            Instantiation of Chaincode using Fabric Node SDK gives API error (404): manifest for hyperledger/fabric-ccenv:latest not found
            Asked 2020-Jul-16 at 12:40

            I am trying to instantiate a Golang chaincode on my Hyperledger Fabric network (setup on cloud) using Fabric Node SDK. However, I am facing the following error while performing the same:

            ...

            ANSWER

            Answered 2020-Jul-12 at 15:08

            latest tag isn't available anymore. you have to use specific tag. Below is the snippet of dave comment infabric-maintainers group.

            Source https://stackoverflow.com/questions/62860545

            QUESTION

            "what is the proper way to disconnect peers using simple-peer.js library and stop streaming between those peers? "
            Asked 2020-Mar-11 at 04:30

            i hope y'all will be fine,

            I am a beginner in webRTC sorry if my question feels like a noob one but i was wondering that is there any proper way to close the connection among peers especially using simple-peer.js, looking forward for your awesome replies

            here is my sample react code,

            ...

            ANSWER

            Answered 2020-Feb-22 at 06:10

            The function is peer.destroy().

            Fyi, if you need to find undocumented API functions in Javascript libraries, you can do this by running your JS file in the browser and pressing F12 to bring up the debugging console. Set a breakpoint after the object that you want to investigate is instantiated:

            I set a breakpoint AFTER I instantiated peer1 (line 51). Then I hovered over peer1 (line 50) to pop up a menu of all of the properties (methods and fields) belonging to this object. If you're looking for a particular function as in this case, sometimes you find it immediately in this menu, but often you have to expand the property called __proto__ :

            You can see the destroy function located here. It's just a guess whether or not a function found in this manner actually does what you want it to do, but luckily in this case it does what we want.

            Source https://stackoverflow.com/questions/56541928

            QUESTION

            Querying chaincode is only successful in ~3/5 cases with nodejs
            Asked 2019-Sep-10 at 18:29

            I successfully installed and instantiated chaincode on my chain. I'm able to enroll the admin and register a user trough nodejs. If I query the chaincode it only returns a correct response around 3 out of 5 times. The rest throws errors that the chaincode can't be found.

            The chaincode installed is the basic example from the fabric samples. My js file to query the chaincode (based on the fabcar example):

            ...

            ANSWER

            Answered 2019-Sep-10 at 18:29

            Looking at the logs I can see why sometimes you get peer0 and occasionally you get peer1, and that is because the discovery results and processing result in it not being possible to get the list of peers in any particular order so with 2 peers in your org and the fact that this is not a long running app but a short running invocation sometimes peer0 will be first in the list of peers and sometimes peer1. Because you have only installed the chaincode on peer0, peer1 can't honour the evaluate request and return an error.

            The node-sdk should detect this and then try peer0 but either you are using an older version of the node-sdk which definitely had an issue where it did not try a different peer or the node-sdk is thinking this is (incorrectly, but may not be able to distinguish) a chaincode response and passes that back to the caller. The solution to avoid the error is to install the chaincode on all the peers.

            Source https://stackoverflow.com/questions/57859872

            QUESTION

            Hyperledger Explorer not starting on 8080 (discover issue)
            Asked 2019-May-30 at 16:06

            Running hlf 1.4 and latest explorer in kubernetes. Explorer hangs in the start phase where it tries to reach peers. It doesn't reach the code were it starts web interface.

            Peer has chaincode installed, connected to channel, no issues.

            I have disabled TLS to make investigation easier and put logs in Channel.js, Peer.js in explorer dependencies to better investigate it.

            I have added log to Channel.js in /blockchain-explorer/node_modules/fabric-client/lib/Channel.js to print connect to target and I can see that it shows grpc://localhost:undefined. I believe it tries to send request to invalid address and silently dies. Entire file https://gist.github.com/gad0lin/51384bfea1c207ccf016a0cad8e413b6#file-channel-js-L3474.

            ...

            ANSWER

            Answered 2019-May-30 at 16:06

            I found the culprit. There were two issues.

            1. I didn't set environment variable DISCOVERY_AS_LOCALHOST to false in explorer config. That was the reason I saw: localhost.

            2. In peer I had set variable CORE_PEER_GOSSIP_EXTERNALENDPOINT, but without port. That was the reason I saw undefined as port.

            Source https://stackoverflow.com/questions/56366628

            QUESTION

            cannot take data on Hyperledger Composer-rest-server after a few minutes, timeout
            Asked 2018-Dec-20 at 09:29

            I have created an Hyperledger Composer-rest-server from azure Ubuntu server. I tried to connect it with amazon server, I have successfully connected them. The only problem is that I cannot install composer-rest-server from amazon side nor install business card from amazon side. So I opened up composer-rest-server from azure side. But after a while, the server will not giving anymore data. It will give error time out that looks like

            ...

            ANSWER

            Answered 2018-Dec-20 at 09:29

            There have been some changes to "grpc" one of the underlying protocols used by Fabric, and this can cause timeout problems.

            You can change the default grpc options for the Composer REST Server connection to the peers by modifying the connection.json of the card you are using to start the REST server.

            For each peer in the connection.json add the following settings:

            Source https://stackoverflow.com/questions/53864854

            QUESTION

            How to implement PeerJS server with Meteor?
            Asked 2018-Apr-13 at 11:15

            I am using PeerJS for audio calling functionality in my project. Their website is down and the cloud servers are no longer working.

            The solution I came across is to use peerjs-server library.

            I also came across the answer in this question that explains how to use peerjs-server.

            My question is what should I use in path in the following code:

            ...

            ANSWER

            Answered 2018-Apr-13 at 08:05

            My question is what should I use in path in the following code

            You can find this out yourself by peeking into the code of the repo.

            There you can see, that the path option of PeerServer will be used as part of an express app, that itself creates a websocket connection:

            Source https://stackoverflow.com/questions/49807733

            QUESTION

            peer.js webrtc >> changing stream in runtime
            Asked 2018-Apr-04 at 07:35

            I am developing a cross-plattform application with peer.js and webrtc. I am using cordova, crosswalk. Additionaly I am using the webrtc adapter (https://github.com/webrtc/adapter)

            My code is based on the webrtc-crosswalk sample. (https://github.com/crosswalk-project/crosswalk-samples)

            I want to change the videosource of the stream without creating a new call. My approche is to remove the tracks of the stream and add the new tracks of the other camera. The result is that the local video shows the right content, but the callee's remote video freezes.

            Probably I am doing a very basic mistake, but i can't find a solution. I am looking forward to your answers and solutions.

            My main codefile is attached.

            Greez, Leo

            ...

            ANSWER

            Answered 2018-Apr-04 at 07:35

            If you remove and then add a new track to a PeerConnection you need to renegotiate the offer-answer to get it working. I will recommend you to use the replaceTrack API to avoid the re-negotiation problem while changing the camera input.

            Source https://stackoverflow.com/questions/49543086

            QUESTION

            Instantiate chaincode, sendPeersProposal - Promise is rejected: Error: REQUEST_TIMEOUT, Hyperledger Fabric, linux
            Asked 2018-Mar-29 at 11:23

            I am getting timeout error from peers while instantiating chaincode on particular peers from fabric node sdk on linux os.

            ...

            ANSWER

            Answered 2018-Mar-29 at 08:04

            you are correct about the process. If all the operations are good, then I think the docker file is good. But you have to make sure, you can only instantiate the chain code from the peer in which the chain code is installed. Because the chain code installation will not change the channel config.

            Source https://stackoverflow.com/questions/49493581

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install peer.js

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/MrSwitch/peer.js.git

          • CLI

            gh repo clone MrSwitch/peer.js

          • sshUrl

            git@github.com:MrSwitch/peer.js.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link