Git Product home page Git Product logo

peerjs-server's Introduction

Build Status node David npm version Downloads Docker Image Size (latest semver)

PeerServer: A server for PeerJS

PeerServer helps establishing connections between PeerJS clients. Data is not proxied through the server.

Run your own server on Gitpod!

Open in Gitpod

Usage

Run server

Natively

If you don't want to develop anything, just enter few commands below.

  1. Install the package globally:

    $ npm install peer -g
  2. Run the server:

    $ peerjs --port 9000 --key peerjs --path /myapp
    
      Started PeerServer on ::, port: 9000, path: /myapp (v. 0.3.2)
  3. Check it: http://127.0.0.1:9000/myapp It should returns JSON with name, description and website fields.

Docker

Also, you can use Docker image to run a new container:

$ docker run -p 9000:9000 -d peerjs/peerjs-server
Kubernetes
$ kubectl run peerjs-server --image=peerjs/peerjs-server --port 9000 --expose -- --port 9000 --path /myapp

Create a custom server:

If you have your own server, you can attach PeerServer.

  1. Install the package:

    # $ cd your-project-path
    
    # with npm
    $ npm install peer
    
    # with yarn
    $ yarn add peer
  2. Use PeerServer object to create a new server:

    const { PeerServer } = require("peer");
    
    const peerServer = PeerServer({ port: 9000, path: "/myapp" });
  3. Check it: http://127.0.0.1:9000/myapp It should returns JSON with name, description and website fields.

Connecting to the server from client PeerJS:

<script>
	const peer = new Peer("someid", {
		host: "localhost",
		port: 9000,
		path: "/myapp",
	});
</script>

Config / CLI options

You can provide config object to PeerServer function or specify options for peerjs CLI.

CLI option JS option Description Required Default
--port, -p port Port to listen (number) Yes
--key, -k key Connection key (string). Client must provide it to call API methods No "peerjs"
--path path Path (string). The server responds for requests to the root URL + path. E.g. Set the path to /myapp and run server on 9000 port via peerjs --port 9000 --path /myapp Then open http://127.0.0.1:9000/myapp - you should see a JSON reponse. No "/"
--proxied proxied Set true if PeerServer stays behind a reverse proxy (boolean) No false
--expire_timeout, -t expire_timeout The amount of time after which a message sent will expire, the sender will then receive a EXPIRE message (milliseconds). No 5000
--alive_timeout alive_timeout Timeout for broken connection (milliseconds). If the server doesn't receive any data from client (includes pong messages), the client's connection will be destroyed. No 60000
--concurrent_limit, -c concurrent_limit Maximum number of clients' connections to WebSocket server (number) No 5000
--sslkey sslkey Path to SSL key (string) No
--sslcert sslcert Path to SSL certificate (string) No
--allow_discovery allow_discovery Allow to use GET /peers http API method to get an array of ids of all connected clients (boolean) No
--cors corsOptions The CORS origins that can access this server
generateClientId A function which generate random client IDs when calling /id API method (() => string) No uuid/v4

Using HTTPS

Simply pass in PEM-encoded certificate and key.

const fs = require("fs");
const { PeerServer } = require("peer");

const peerServer = PeerServer({
	port: 9000,
	ssl: {
		key: fs.readFileSync("/path/to/your/ssl/key/here.key"),
		cert: fs.readFileSync("/path/to/your/ssl/certificate/here.crt"),
	},
});

You can also pass any other SSL options accepted by https.createServer, such as `SNICallback:

const fs = require("fs");
const { PeerServer } = require("peer");

const peerServer = PeerServer({
	port: 9000,
	ssl: {
		SNICallback: (servername, cb) => {
			// your code here ....
		},
	},
});

Running PeerServer behind a reverse proxy

Make sure to set the proxied option, otherwise IP based limiting will fail. The option is passed verbatim to the expressjs trust proxy setting if it is truthy.

const { PeerServer } = require("peer");

const peerServer = PeerServer({
	port: 9000,
	path: "/myapp",
	proxied: true,
});

Custom client ID generation

By default, PeerServer uses uuid/v4 npm package to generate random client IDs.

You can set generateClientId option in config to specify a custom function to generate client IDs.

const { PeerServer } = require("peer");

const customGenerationFunction = () =>
	(Math.random().toString(36) + "0000000000000000000").substr(2, 16);

const peerServer = PeerServer({
	port: 9000,
	path: "/myapp",
	generateClientId: customGenerationFunction,
});

Open http://127.0.0.1:9000/myapp/peerjs/id to see a new random id.

Combining with existing express app

const express = require("express");
const { ExpressPeerServer } = require("peer");

const app = express();

app.get("/", (req, res, next) => res.send("Hello world!"));

// =======

const server = app.listen(9000);

const peerServer = ExpressPeerServer(server, {
	path: "/myapp",
});

app.use("/peerjs", peerServer);

// == OR ==

const http = require("http");

const server = http.createServer(app);
const peerServer = ExpressPeerServer(server, {
	debug: true,
	path: "/myapp",
});

app.use("/peerjs", peerServer);

server.listen(9000);

// ========

Open the browser and check http://127.0.0.1:9000/peerjs/myapp

Events

The 'connection' event is emitted when a peer connects to the server.

peerServer.on('connection', (client) => { ... });

The 'disconnect' event is emitted when a peer disconnects from the server or when the peer can no longer be reached.

peerServer.on('disconnect', (client) => { ... });

HTTP API

Read /src/api/README.md

Running tests

$ npm test

Docker

We have 'ready to use' images on docker hub: https://hub.docker.com/r/peerjs/peerjs-server

To run the latest image:

$ docker run -p 9000:9000 -d peerjs/peerjs-server

You can build a new image simply by calling:

$ docker build -t myimage https://github.com/peers/peerjs-server.git

To run the image execute this:

$ docker run -p 9000:9000 -d myimage

This will start a peerjs server on port 9000 exposed on port 9000 with key peerjs on path /myapp.

Open your browser with http://localhost:9000/myapp It should returns JSON with name, description and website fields. http://localhost:9000/myapp/peerjs/id - should returns a random string (random client id)

Running in Google App Engine

Google App Engine will create an HTTPS certificate for you automatically, making this by far the easiest way to deploy PeerJS in the Google Cloud Platform.

  1. Create a package.json file for GAE to read:
echo "{}" > package.json
npm install express@latest peer@latest
  1. Create an app.yaml file to configure the GAE application.
runtime: nodejs

# Flex environment required for WebSocket support, which is required for PeerJS.
env: flex

# Limit resources to one instance, one CPU, very little memory or disk.
manual_scaling:
  instances: 1
resources:
  cpu: 1
  memory_gb: 0.5
  disk_size_gb: 0.5
  1. Create server.js (which node will run by default for the start script):
const express = require("express");
const { ExpressPeerServer } = require("peer");
const app = express();

app.enable("trust proxy");

const PORT = process.env.PORT || 9000;
const server = app.listen(PORT, () => {
	console.log(`App listening on port ${PORT}`);
	console.log("Press Ctrl+C to quit.");
});

const peerServer = ExpressPeerServer(server, {
	path: "/",
});

app.use("/", peerServer);

module.exports = app;
  1. Deploy to an existing GAE project (assuming you are already logged in via gcloud), replacing YOUR-PROJECT-ID-HERE with your particular project ID:
gcloud app deploy --project=YOUR-PROJECT-ID-HERE --promote --quiet app.yaml

Privacy

See PRIVACY.md

Problems?

Discuss PeerJS on our Discord community: https://discord.gg/Ud2PvAtK37

Please post any bugs as a Github issue.

peerjs-server's People

Contributors

afrokick avatar brunobg avatar cashpipeplusplus avatar dependabot[bot] avatar dylannz avatar ericz avatar etylermoss avatar floatdrop avatar gitouche-sur-osm avatar heapwolf avatar hobindar avatar igrigorik avatar jonasgloning avatar jondavidjohn avatar kidandcat avatar lmb avatar luizbills avatar mend-bolt-for-github[bot] avatar michelle avatar michelle-stripe avatar millette avatar prashoon123 avatar psanders avatar redexp avatar renovate[bot] avatar semantic-release-bot avatar stanego avatar t49tran avatar yosssi avatar zhou-yg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

peerjs-server's Issues

Allow to specify listen address

Since server.listen doesn't specify a hostname, currently we can only listen to INADDR_ANY. Users may want to be able to specify addresses such as 127.0.0.1.

Can peerjs server be deployed on more than one process?

Can I run peerjs server on more than one process (e.g. dyno on Heroku, or drone on Nodejitsu)? E.g. Socket.io has different stores (by default it's memory store, but it can be switched e.g. to Redis) to allow running it on multiple processes.

Where peerjs server is currently hosted and what kind of traffic does it get? I'll have to deploy it on my own server (I need SSL) and unfortunately I have very little experience with managing servers, especially Node.js and WebSockets.

Send rate is strange

PLEASE CLOSE THIS ISSUE
The test was made with 2 Chrome tabs in the same window.
The loop in the unfocused tab will run in a rate smaller than 100ms.
Created the 2 test tabs in different windows and the loop was correct on both.

First, thanks for the awesome tool! RTC can't be more easy :)

I have an application with an 'OnUpdate' callback wich sends data using 'connection.send(Time.elapsed)' each 0.1 seconds (~100ms).
In the receiving peer I put a 'console.log()' in the 'connection.on("data",...)' to check the data arriving.
For a bit of time it receives the string data correctly "1.1,1.2,1.3,..." after sometime it starts receiving "1.3,2.3,3.3,4.3,..." (one 'data' event per second). Eventually chrome catches this excetion too:

image

The line error is here:

image

HTTP size limit reached for offers.

Example:

PeerJS:  Invalid server message {"type":"OFFER","src":"tbw0udvbc9grpb9","dst":"sihbeqq2h2ztcsor","payload":{"sdp":{"sdp":"v=0\r\no=- 2743897879 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE audio data\r\na=msid-semantic: WMS\r\nm=audio 1 RTP/SAVPF 103 104 111 0 8 107 106 105 13 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:1 IN IP4 0.0.0.0\r\na=ice-ufrag:K9kVlCnNZXFyr1jI\r\na=ice-pwd:hapWWUTKGD0vII4ww9DYzSY+\r\na=ice-options:google-ice\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=recvonly\r\na=mid:audio\r\na=rtcp-mux\r\na=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:+TCAGLQt0OjRBxr1vlVhFgWKxnPkoAIi4SrAASzE\r\na=rtpmap:103 ISAC/16000\r\na=rtpmap:104 ISAC/32000\r\na=rtpmap:111 opus/48000/2\r\na=fmtp:111 minptime=10\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:107 CN/48000\r\na=rtpmap:106 CN/32000\r\na=rtpmap:105 CN/16000\r\na=rtpmap:13 CN/8000\r\na=rtpmap:126 telephone-event/8000\r\na=maxptime:60\r\nm=application 1 RTP/SAVPF 101\r\nc=IN IP4 0.0.0.0\r\na=rtcp:1 IN IP4 0.0.0.0\r\na=ice-ufrag:K9kVlCnNZXFyr1jI\r\na=ice-pwd:hapWWUTKGD0vII4ww9DYzSY+\r\na=ice-options:google-ice\r\na=sendrecv\r\na=mid:data\r\nb=AS:30\r\na=rtcp-mux\r\na=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:+TCAGLQt0OjRBxr1vlVhFgWKxnPkoAIi4SrAASzE\r\na=rtpmap:101 google-data/90000\r\na=ssrc:1955358033 cname:ZaP+F0FuaA1Pgj8O\r\na=ssrc:1955358033 msid:peerjs peerjs\r\na=ssrc:1955358033 mslabel:peerjs\r\na=ssrc:1955358033 label:peerjs\r\n","type":"offer"},"serialization":"b 

Potential fix is to have more of a stream interface where invalid messages are queued and parsed together.

Implement Test suite

It might be easier to track down issues if you had a test suite to test against. It'll also make it easier for folks, like me, wanting to help to visualize what does work as expected or where tests break down or are missing. Could you implement a test suite?

addIceCandidate called without success/failure callbacks. This is deprecated, and will be an error in the future.

Just letting you know, firefox now expects callbacks.

addIceCandidate()

addIceCandidate (RTCIceCandidate candidate, Function successCallback, RTCPeerConnectionErrorCallback failureCallback);

The addIceCandidate() method provides a remote candidate to the ICE Agent. In addition to being added to the remote description, connectivity checks will be sent to the new candidates as long as the "IceTransports" constraint is not set to "none". This call will result in a change to the connection state of the ICE Agent, and may result in a change to media state if it results in different connectivity being established.

peerJS with 3G doesn't work

Hi,

I'm trying to use the package node-peerjs under 3G, and I've some problem.
I read that a TURN/STUN server must be configured.

Can you tell me if there is another way to solve the problem or a possible configuration for my TURN/STUN server owner (server side), please?

Thanks in advance and regards.

The `timeout` cmd line option is not being used.

There was a time in the history when it was being used, but at the moment, _options.timeout is not being used anywhere in the code.

If I understood the old implementation correctly, then the timeouts were being handled on a per connection basis whereas now, there is a periodic cleanup every 5 seconds. Hence, the actual connection timeout is random with a mean of 2.5 seconds. Is that intended or is my understanding flawed?

Disconnected from server. Cannot set timeout.

Is there a way to prevent a timeout from the peerjs server? Even after changing the timeout to 0 in lib/index.js and the timeout to 0 in bin/peerjs, my client would still experience a timeout with the peerjs server and a popup would show, saying "Lost connection to server". Is there a way to prevent this?

peer-server crashes

hi!
i'm hosting my own peer server and my server crashes all the time (both 'network' and 'unavailable-id' errors get triggered!)
what should i do?
is there a bug with the sever? when does it get updated?

CORS issue on Heroku

Hey, me again. CORS is working perfectly locally on my server. I can see the headers being added and everything. However, when I deploy my app to Heroku, I once again encounter a CORS issue, and the headers are no longer added. Is this something wrong on Heroku's end?

Connection pinging for Heroku?

I setup a peerjs server on Heroku. Heroku's connections timeout after 55 seconds, unless they are pinged. So we need a way to ping an established connection constantly, otherwise we have to reconnect after 55 secs. How to do this?

I also submitted this issue here: peers/peerjs#278

Server crashes when creating new peer on client side.

I updated to latest peer-server using npm install peer.
After the update I added the new certificate and key fields to the "new PeerServer" line.
since the change everytime a client peer is created the server crashes with the following error:

events.js:74
throw TypeError('Uncaught, unspecified "error" event.');
^
TypeError: Uncaught, unspecified "error" event.
at TypeError ()
at WebSocket.EventEmitter.emit (events.js:74:15)
at Receiver.self._receiver.onerror (/home/ubuntu/GiNoGi/Berimbolo/BeriMbolo_current/Server/node_modules/peer/node_modules/ws/lib/WebSocket.js:669:10)
at Receiver.error (/home/ubuntu/GiNoGi/Berimbolo/BeriMbolo_current/Server/node_modules/peer/node_modules/ws/lib/Receiver.js:301:8)
at Receiver.processPacket (/home/ubuntu/GiNoGi/Berimbolo/BeriMbolo_current/Server/node_modules/peer/node_modules/ws/lib/Receiver.js:187:10)
at Receiver.add (/home/ubuntu/GiNoGi/Berimbolo/BeriMbolo_current/Server/node_modules/peer/node_modules/ws/lib/Receiver.js:93:24)
at CleartextStream.firstHandler (/home/ubuntu/GiNoGi/Berimbolo/BeriMbolo_current/Server/node_modules/peer/node_modules/ws/lib/WebSocket.js:627:22)
at CleartextStream.EventEmitter.emit (events.js:95:17)
at CleartextStream. (_stream_readable.js:736:14)
at CleartextStream.EventEmitter.emit (events.js:92:17)

Servers connection event does not occurr

Hi peers team,
With the following node.js code I somehow do not get any connection events on the server but because the disconnect event occurrs somehow peers can connect.
Am I doing something wrong?

var PeerServer = require("peer").PeerServer;
var peerServer = new PeerServer({ port: 8081 });

peerServer.on("connection", function (id) {
    console.log("Peer connection event:", id);
});
peerServer.on("disconnect", function (id) {
    console.log("Peer disconnect event:", id);
});

Unexpected connection timeouts (in POST handler)

Hi,

I'm seeing unexpected connection timeouts with a self-hosted PeerJS server. The browser (latest Chrome) connects to the server fine (via WS), but disconnects after five seconds because the POST request to /key/id/token/id (see server.js:223 times out / is cancelled . Seems like something makes the connection hang, which is then killed somewhere. _pruneOutstanding is a likely culprit, due to the similar timeout.

Thanks!
I can provide a HAR of such a web session via e-mail, since github only seems to allow attaching images.

HTTPS SSL gotcha

Just wanted to point out to anyone else trying this, node will ignore self signed certificates. So if you're trying to run this over https you need a real certificate.

It may be that this can be adjusted in a setting somewhere, but I'm not sure where this would be in the dependency stack, so it was easier for me to just get a real certificate.

Custom message to Client?

Hi,
basically, I'd like to implement AUTH bootstrap in server.js
PeerServer.prototype._initializeWSS
such as

  if (true) // true for auth passed
            {
                socket.send(JSON.stringify(
                {
                    type: 'SUCCESS',   //got WARNING You received an unrecognized message: [object Object]
                    payload:
                    {
                        msg: id + ': Authorizaton Success'
                    }
                }));

                f(); // go on the rest
            }
            else
            {
                socket.send(JSON.stringify(
                {
                    type: 'ERROR',   //works fine as it is
                    payload:
                    {
                        msg: id + ': Authorizaton Failed'
                    }
                }));
                socket.close();
                return;
            }

However, in this sample, I tried
type: 'SUCCESS'
and which is unrecognized message at client side.
WARNING You received an unrecognized message: [object Object]

Having googled for a while to find definition of the type, I could not find them.
All the type I can find in the server.js code is
type: 'ERROR',
type: 'ID-TAKEN',
and
type: 'OPEN'
seems to do nothing.

I need to grab a server status for my own implementation in the context of the Connection status:
http://cdn.peerjs.com/demo/chat.html

How can we do this??
The types must be defined somewhere in the code, but somehow I can't find it, so please advise.

I've read
#10
by the way, but no clue.
Thanks.

Why do we need a server at all?

May I kindly ask you for an explanation, why do we need peer server at all? I don't get it. WebRTC works without it at all, so why peer.js library needs a broker? Would you please provide some technical details whats happening under the hood on the server? Just briefly. Thank you.

codec option

Hi, I like PeerJS. But webrtc js app code in https://bitbucket.org/webrtc/codelab and other examples, do have audio codec set, such as preferOpus(), preferISAC(). PeerJS should provide this feature too. I am writing the code and after test I will send a push. I just want to see how you think about this? Thanks!

PeerJS Server EMPTY_RESPONSE prompting periodically

Good afternoon everyone,
The team and I are facing an issue while using PeerJS for a little WebRTC project while trying to establish a connection to our server peer.
The issue prompted oftenly between two test with one OK and no changes between tests. This is what we read in our browser Network tab :

Request URL:
    http://server-ip:9000/peerjs/HelloWorldServer16/v2b3bzn3cbzw7b9/id?i=0

Request Headers
    Provisional headers are shown
Origin:
    http://localhost:8080
Referer:
    http://localhost:8080/
User-Agent:
    Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) 
    AppleWebKit/537.36 (KHTML, like Gecko) 
    Chrome/41.0.2272.118 Safari/537.36
Query String
    i:0

In the Console :

POST 
http://server-ip:9000/peerjs/HelloWorldServer16/v2b3bzn3cbzw7b9/id?i=0 
net::ERR_EMPTY_RESPONSE

It ended with :

WebSocket connection to 'ws://server-ip:9000/peerjs?key=peerjs&id=HelloWorldServer16&token=v2b3bzn3cbzw7b9' 
failed: Connection closed before receiving a handshake response

I let you look further about this issue and decide if it concerns a patch or not.

Thank you and good bye :-)

Peerjs broker protocol

Hi Peerjs team!

To test a client browser's compatibility, I'm writing a Python peerjs client. Consider this flow:

  1. Client browser creates a new peer:

    peer = new Peer('', {options});

  2. Client posts peer info to web server:

    xhr('/some-url', {peer-info})

  3. Server uses Python peerjs client to create a p2p connection and send the Client browser a message.

I know peerjs is meant for browser p2p RTC but me thinks a python client (just the brokering) might be helpful for testing a client's capabilities? I don't need help on the actual webRTC protocol just communicating with the peerjs server to connect to the browser. If someone could point me to the right direction? Thanks!

Only the first part of client ID is used

When there's a long key used as client ID like f95743c4-8a9f-448e-afd9-e2e06afcf33f02153775104, only the first part is used. I know that because when I listen to “open“ event, I get back the first part of client ID which is f95743c4-8a9f-448e-afd9-e2e06afcf33f.

The length limit should be removed or there should be a warning that only the first characters will be used as a client ID.

Question about Man-in-the-middle attacks

Hi guys,

First, thanks for your outstanding work!! PeerJS/WebRTC rocks!

We are implementing Copay, a bitcoin wallet using peerjs. It is open source https://github.com/bitpay/copay. I have some question regarding peerjs/webRTC and
man-on-the-middle attacks.

  1. Are communications between the peers encrypted (using peerjs and peerjs-server) by default? Which schema is used? How the keys are generated?

  2. is there a standard way to prevent man-on-the-middle attack given a compromised peerjs-server? This is the schema we are doing now:
    1- share with the peer (using a offline channel) a pub key
    2- the peer uses that pubkey to encrypt messages, and send his pubkey to the initial peer. The initial peer shares with other peers the new peer's pubkey, and so a secure channel is stablished.

thanks a lot.
matías

Error: Server has reached its concurrent user limit

Hey, I'm running PeerJS on a heroku dyno, and this message poped up on my Chrome console when testing today. Any idea how I can get around this limit, or what could even be causing it? There's only four people testing with the server at the moment.

Looking for development and integrating peerjs into website

Hello guys and girls,

I read like 40 posts at least both on github and google groups so I can better understand how peerjs work, what's the solutions, bugs etc.

I am not developer, I am webmaster and thinking of WRTC technology for long time. Also, I am so happy i found peerjs source code and now hoping to find someone who is willing to play and integrate it into my user base website.

Sorry if this is not place to hire freelancer, cause I see here is only talk about problems and solutions. But I think this is best place to find someone related to peerjs and who already played.

Anyone interested for work, please add me on skype: ksifoking or email: shtefistefi[monkey]yahoo.co.uk

Stefan

cloud server down?

Hello,

since a couple of minutes the cloud server seems to doesn't work anymore. I get empty http responses.

Best regards
Matthias

Data not persistent?

Apparently peer-server isn't using any persistent data store atm. Is there any work on that going on? If not I might need to hack on that. I have Redis/Mongo in mind. What do you guys think?

Allow mounting into express.js application

The PeerJS server is definitely a nice piece of software, but it would be great if it could be mounted into an existing express.js application. This would allow people to build more advanced applications around the server.

Don't use restifyjs. It spoils nodejs internals.

RestifyJs writes into nodejs internal request-object prototype (look). For example, restify write to request.query it's own function (look).

So, if I, for example, try to start peerjs-server together with expressjs-server (at the same app) - the expressjs get broken request.query.

CORS & HEROKU

Hi,

I wasn't able to run the project properly on heroku because when i called the url:
https://fileportal.herokuapp.com:9000 i don't get any result.

To resolve it, I had to remove the port from the URL (I modified the file peer.js) because Heroku manage the port internaly

_generateClientId is generating 14 character id

While testing express migration I got this error:

1) PeerServer #_generateClientId should generate a 16-character ID:
     Error: expected 14 to be within 15..16
      at Assertion.assert (/Users/floatdrop/peerjs-server/node_modules/expect.js/index.js:96:13)
      at Assertion.within (/Users/floatdrop/peerjs-server/node_modules/expect.js/index.js:248:10)
      at Function.within (/Users/floatdrop/peerjs-server/node_modules/expect.js/index.js:499:17)
      at Context.<anonymous> (/Users/floatdrop/peerjs-server/test/server.js:202:64)
      at callFn (/Users/floatdrop/peerjs-server/node_modules/mocha/lib/runnable.js:223:21)
      at Test.Runnable.run (/Users/floatdrop/peerjs-server/node_modules/mocha/lib/runnable.js:216:7)
      at Runner.runTest (/Users/floatdrop/peerjs-server/node_modules/mocha/lib/runner.js:374:10)
      at /Users/floatdrop/peerjs-server/node_modules/mocha/lib/runner.js:452:12
      at next (/Users/floatdrop/peerjs-server/node_modules/mocha/lib/runner.js:299:14)
      at /Users/floatdrop/peerjs-server/node_modules/mocha/lib/runner.js:309:7
      at next (/Users/floatdrop/peerjs-server/node_modules/mocha/lib/runner.js:247:23)
      at Object._onImmediate (/Users/floatdrop/peerjs-server/node_modules/mocha/lib/runner.js:276:5)
      at processImmediate [as _immediateCallback] (timers.js:330:15)

On second run it disappears - this function should be tested more strictly.

somebody try to stress test the server?

how many users can it handle? does it use websocket to keep connection open to the server?

and whats the right way to add more functionality like rooms? or finding available to chat users? create a new server to handle this or to extend this server? thanks

Cross-origin issue

I tried running the current version of peerjs-server and got CORS errors because the CORS headers weren't present. I looked through the code and noticed the http app is supposed to be adding them, but I didn't see them when making requests manually, and the middleware util that adds the headers didn't seem to be firing at all.

Allow for basic drop-in auth upon UID.

A nice feature would be something like if I could do

...
var server = new PeerServer({ port: 9000, auth: function(id, context)
{
  return database.validate({username: id, password: context.password});
}});
...

The function could be any other type of validation, i.e. validating an ip matches an id or etc.

Note: peer.js has to be edited to be able to pass context variables through configuration upon new Peer().

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.