sourceplaze
sourceplaze

Reputation: 333

How to implement PeerJS server with Meteor?

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:

var PeerServer = require('peer').PeerServer;
var server = PeerServer({port: 9000, path: '/myapp'});

Is it the peer.js file that I downloaded from here?

NOTE: the call functionality used to work, until PeerJS server went down and so does their website.

I would also appreciate any tips and guidance on how to implement peerjs-server in Meteor.

Upvotes: 3

Views: 521

Answers (2)

Tsahi Levent-Levi
Tsahi Levent-Levi

Reputation: 2386

You shouldn't be using PeerJS if your plan is to actually launch a product.

PeerJS is old and unmaintained - it is dead. You should be looking for other frameworks, ones that are more popular.

https://bloggeek.me/mistakes-developing-webrtc-applications/

Now, if what you are planning to end up with is group video calling, then look at Janus, Jitsi or Kurento - they should be better suited for what you need (and probably will have better, more updated code in them).

Don't expect anyone to host the signaling of the solution for you for free either.

Upvotes: 3

Jankapunkt
Jankapunkt

Reputation: 8423

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:

var peerjs = ExpressPeerServer(server, options);
app.use(path, peerjs);

Where ExpressPeerServer is wrapping the epxress app with some extended functionality.

The lines above basically mean, that the express app with it's websocket connection will utilize the peerjs instance on the given (relative) path or route.

So you should not require to "download" any peerjs file and pass it but make yourself clear which route you will pass to your peerjs-server instance as path option so that it will not interfere with your router and other routes you already use in your appplication.

Upvotes: 1

Related Questions