New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run peerjs client in a node.js application? #103
Comments
I found an initiative by @helloIAmPau to create a node.js implementation of WebRTC: https://github.com/helloIAmPau/node-rtc/. Maybe it is possible to bundle forces? |
Hey Jos, I'll keep an eye on it. When there is a reliable webrtc node client it On Wed, Nov 6, 2013 at 6:46 AM, Jos de Jong notifications@github.comwrote:
510-691-3951 |
See https://github.com/modeswitch/node-webrtc aswell. I think node-rtc is being replaced by it. |
Thanks Eric, that would be great. This would also enable a node.js application working as an MCU to control video/audio streams for a group of peers (conference call), in a star architecture as explained by Justin Uberti on the last Google I/O on WebRTC (from 23:19). Node.js is good at dealing with streams so that could be a great fit. |
@ericz what is the reason to close this issue? Support for node.js would be really awesome and powerful. |
Hey josdejong, I closed it because there's no action item but I'll reopen it so we can keep tabs on the feature :) |
ok thanks. Feel free to adjust the title to something like "node.js support" and give the issue a proper label... |
👍 This would be a pretty helpful feature. |
👍 Upvoting for this too. |
👍 much needed |
+1 |
I managed to mock some objects and get peerjs running on node.js
I managed to get peerjs setting up connections and server get connections. However, when I try to send data I get follow error
Here is the complete gist https://gist.github.com/piyushranjan/1204bc579b7c1f5a3e84 And these npm packages must be installed
|
Ah, this is really awesome! Will take a look :). Michelle On Tue, May 6, 2014 at 7:37 AM, Piyush Ranjan notifications@github.comwrote:
|
@michelle any luck with this already? I tried, and opening a connection seems to work but sent messages are never received. |
👍 for this feature |
1 similar comment
👍 for this feature |
👍 |
👍👍👍 |
I was wondering what the status of this was? It would be awesome if this was supported? |
There is a node module for peerjs, but I think it doesn't work yet. When I require it, I get window is not defined, which is a fair objection. So I am curious: is there something going on? Would be so awesome to have it! ;) |
This node module is for the browser code :). Michelle On Thu, Oct 23, 2014 at 11:37 AM, Lixissimus notifications@github.com
|
So what is it supposed to do? |
I don't know if I am just confused about node, but seems strange to have an npm module for peerjs, if the peerjs module itself can only be used from the browser? |
Sorry, this was before we began publishing the library on bower. Michelle On Thu, Oct 23, 2014 at 11:51 AM, Alan Chusuei notifications@github.com
|
@AChusuei I don't see any problem in having browser specific libraries in npm, or isomorphic libraries. For my full stack JS web applications I like to have to deal with npm only, rather than having to fetch half of the Iibraries from npm and the other half from bower. @michelle I really hope peerjs will get support for a node.js client!! |
@josdejong, I guess you could do it that way. I am still new to the node world, open to doing things differently! |
Is this what you're looking for? https://github.com/socketio/socket.io-p2p from the readme: "This module provides an easy and reliable way to setup a WebRTC connection between peers and communicate using events (the socket.io-protocol). Socket.IO is used to transport signalling data and as a fallback for clients where WebRTC PeerConnection is not supported." |
As far as I am concerned, it doesn't work on Node. That's why I ran into this thread. |
Hmm. Could you be more specific? I'm using it right now, using a node server to connect peers which then establish webRTC connections to each other and/or the node server's machine. |
So, you're not running it as a client. You're running it on a server that connects other clients (which you don't mention to be node apps - if they are, I'd be interested how you set them up). |
The second part of that seems like exactly what is being discussing here. Can anyone else confirm this? |
No, the issue is using NodeJS as a WebRTC client. Ie. connect from a NodeJS instance that is not necessarily the server. |
Oh, apologies. SimplePeer will do that. But it requires the server platform to have certain webrtc capabilities installed. The 'wrtc' module provides this on most machines. Notably not on a raspberry pi right now, in case that matters to you (it does to me!) snippet from their readme.md: in node To use this library in node, pass in opts.wrtc as a parameter: var SimplePeer = require('simple-peer') var peer1 = new SimplePeer({ initiator: true, wrtc: wrtc }) |
+1 this would be a nice feature |
Check out electron-webrtc, or webrtc-native. I use electron-webrtc for my node.js instance to connect with browsers (using the datachannel specifically) |
Overview Key things about what (not) to do: Having to do everything by yourself is hard, so here is the code: BinaryPack = require("binary-pack") RTCPeerConnection = wrtc.RTCPeerConnection; WebSocket = require('ws') var peer = new Peer( var conn=peer.connect('id') That`s it, regards, JP |
Hi @jeryfast , thanks for your solutions, I was looking for something like that 👍 I test it on a mac (not on the raspberry yet) and was getting the error "Failed to set the 'binary Type' property on 'RTCDataChannel': Blob support not implemented yet" After some search, found that on file utils, on path node_modules/peerjs/lib around line 116:
that is causing the error and the app to crash. If the code is commented the app works and it behaves as a browser client, just beautiful. But is a dirty hack, so I was looking a way to "configure" or do something that don't be change code from the lib, but until now I don't found any. The challenge resides in when that piece of code is executed, that is on the module Load process, when the require of the exports is done:
Any one has and ideia or suggestion on how to correct this? Regards |
Nice, if you use 'none' serialization, it works also, without changing anythings in a library. Regards |
Hi again @jeryfast it works on the Raspberry as you said. The issue on my last post is related with to OS X. Well the thing is great work 👍 No lets start the fun 💃 |
Hello
|
@crosogf, that error looks to me like a symptom of a larger problem. It appears that the only place postMessage is used is in error-handling code. My guess would be that it has something to do with binary blob support detection in lib/util.js (the code @nuno-nlfsoftware says to comment out). I noticed that there are two places that code is present, in dist/peer.js or dist/peer.min.js, and in lib/util.js. For me, only modifications to the latter were effectual (due to @jeryfast's hack of requiring lib/exports.js). |
…on a server side nodejs app this is mainly a hack. may run into issues when attempting to send actual binary data. peers#103
cobble together hack found here: peers/peerjs#103 (comment) and here: peers/peerjs#103 (comment) to get peerjs working in a node app peers/peerjs#103
I'm just gonna leave this here https://www.npmjs.com/package/peerjs-nodejs |
Also, the connection serialization doesn't have to be set to |
Thanks, I think it should be a part of PeerJS. |
here is my code after test
|
Hello, I'm getting this error, as soon as I create a Peer instance (using server.js
Can somebody help? Thanks. |
Same issue here, not sure if the package is managed |
Came here looking for what the title says – a solution to run peerjs on nodejs. Both linked packages (peerjs-on-node and peerjs-nodejs) seem to be completely abandoned and unused. There have been quite a few people inquiring about this feature – what have all of you ended up doing/using? @ericz you said that it should be "trivial to port peerjs over" as soon as there's a reliable webrtc client. Do you:
Not sure if it's worth mentioning, but geckos.io provides a webrtc abstraction for node and browser, using node-datachannel. Really happy about any feedback here 🙏 |
Hey @stefanpl, you could try the beta release. It supports PeerJS on the server using Unfortunately, Just out of curiosity, what are you planning to do with PeerJS on the server? |
Thanks for the quick reply @jonasgloning 🎉 Glad to see node support on the roadmap (well, even in the beta) for v2. I'm currently checking options for implementing a realtime multiplayer game. I might very well start the prototype without an authorative server, but this will definitely be needed at some point. Well, if I get that far … 😬 |
Seems like calling a peer from a Node-based client using peerjs@beta is possible, but once the remote peer answers the "stream" event never gets fired on the Node side. Is actually sending/receiving mediastreams supported in NodeJS? |
Would it possible run a peer.js client in a node.js application instead of the browser?
I'm creating a peer-to-peer network consisting of (programmatic) peers living both in browsers and in node.js applications. They have to send data to each other, no video/audio. WebRTC would be a great solution to resolve the routing and communication between the peers without the need for a centralistic client/server structure. But WebRTC seems to be supported only in the browser.
See also this question: http://stackoverflow.com/questions/18872712/node-js-webrtc-client
The text was updated successfully, but these errors were encountered: