Running your own Peer server using Nodejs

1,149 views
Skip to first unread message

alma...@gmail.com

unread,
May 30, 2014, 12:05:52 AM5/30/14
to pee...@googlegroups.com
Hi,

I followed the tutorial from this link https://github.com/peers/peerjs-server and my code is below:

CLIENT:
<script type="text/javascript" src="../peer.js"></script>
<script>
var peer = new Peer({key: 'lwjd5qra8257b9', debug: 3}, {host: 'my.server.ip', port: 9000, path: '/myapp'});

//some code
</script>

SERVER:
var port = 9000;
var PeerServer = require('peer').PeerServer;
var server = new PeerServer({port: port, path: '/myapp'});
console.log('Peer server running on port: ', port);

The server is running, but if I stop the server, the application still works.

- Does that mean the code is using the Peerjs server as a fallback?
- or the way I connect to the server is wrong?
- How would I know the server I'm connected with?

Thanks,

Michelle Bu

unread,
Jun 4, 2014, 12:39:45 PM6/4/14
to alma...@gmail.com, peerjs
Hi there!

By "the application still works," do you mean that you're still able
to make connections? That shouldn't be the case--perhaps the server's
not being stopped properly. If you look in your network panel in
Chrome, you should be able to tell where requests are going.
Michelle
Reply all
Reply to author
Forward
0 new messages