I've tried implementing a peer to server connection with WebRTC, unfortunately node-webrtc doesn't provide typescript types, which makes it really hard to add collaborators, and messes up the codebase.
Is there any other way to make a client to server connection using NodeJS and WebRTC?
Yes! Check out werift-webrtc it is a typescript implementation of WebRTC for node.js
Ok, so instead of using typescript, I've started building my own webrtc broadcadting media server using the native code I found here: https://webrtc.googlesource.com/src/
I also took inspiration from the way Discord created their servers, I found this information on this blog post: https://blog.discord.com/how-discord-handles-two-and-half-million-concurrent-voice-users-using-webrtc-ce01c3187429
I still havent't figured out a way how am I supposed to do this, what I think we have to do is to create a RTC Peer Connection using the api/ directory in the native code, or something like that.
The answer above me, that I've marked as accepted, is useful if you want to go through the nodejs typescript way, I'll try figuring something out and keep you guys updated.
Related
I am trying to build video conferencing web application where multiple people can join the call and there will be video/audio/data transmission. I researched a lot for this. What i understand is we can achieve this using webRTC protocol. I started doing research for js libraries and i came to know for simpleWebRTC. I want to develop with backend as a django. I tried to run sample demo code from https://www.sitepoint.com/webrtc-video-chat-application-simplewebrtc/. but i am not able to establish connection with socket.io which is simplewebRTC signaling sandbox server.
I tried with node express server as well, but still i got the same error:- net::ERR_FAILED. This error occured in simplewebrtc-with-adapter-js while making connection.
What would be the correct technologies to achieve this type of functionality?
Front-end webRTC libraries:- simplewebRTC/ EasyRTC/ Any else apis?
Signaling mechanism:- What and how can we use to connect with webRTC?
Backend:- Node js/Django?
I still confused with the signaling protocols/STUN/TURN servers as we have to define the servers by our self. simpleWebRTC is not providing that which we can use in production.
Any help would be much appreciated!
I just started a video calling and chat application as well. open-easyrtc, no problems so far, their demo just works after npm install.
As for signaling servers, since I just started I haven't concerned myself much about them but the most I can make out of it is it's used for exchanging information like video metadata, network information, etc. open-easyrtc comes with public STUN and TURN servers, not sure about the limitation especially if you're going to have a lot of users.
It's also possible to deploy your own, I'm looking at learning more about coturn
once I finished developing my application.
You can use simple-peer, a simple library for webrtc. Here is an example project with multiple users project, DEMO.
I want to make small chat app in nodejs.
But every where i found that to achieve this functionality node is used with socket.io
As node was also created with push notification in mind so thinking
How to create chat app purely in node if possible ?
Thanks!
I want to make small chat app in nodejs. But every where i found that
to achieve this functionality node is used with socket.io. As node
was also created with push notification in mind so thinking How to
create chat app purely in node if possible ?
Yes, it is possible to create a node.js application that supports chat without using socket.io. You have these choices:
Use a straight webSocket to "push" to the client. You will need to find or write your own server-side code for handling the webSocket protocol because such code is not built into node by default. The ws module is one such library. If using a plain webSocket, you will likely have to implement on your own some of the functionality that socket.io implements such as auto-reconnect.
Find some other library (besides socket.io) that is built on top of a webSocket that would let you push data to a client.
Invent your own substitute for a webSocket (probably client polling or long polling) and code that. This is what was done before webSockets existed. It is much less efficient than a continuously connected webSocket.
All of these choices involve writing some code that has already been written for you in socket.io so most developers would rather just use the already working and already tested solution rather than reimplement it themselves.
To get into further detail in your question, you will need to define what "purely in node" means to really answer this question. That's not a well defined term. The socket.io library is just a library written in Javascript just like thousands of other libraries you can use in node.js to get your job done.
As you quickly see with node programming, you can't do very much at all in a default node instance without loading other libaries. Some of these libraries come with a default installation of node (like the fs library or http library, for example) and others are libraries that you install before using (usually as simple as typing "npm install socket.io") and then var io = require("socket.io");.
If you are not going to use the socket.io library, then you need a mechanism for "pushing" data to a client in order to make a chat application work. The only true "push" that has any cross-browser support is a webSocket. A webSocket is what socket.io uses. You could use a webSocket from node without using socket.io, but you'd have to write or find code that implements the webSocket protocol that you can run on node (the ws module is one such library). Such code is not built into node by default.
If you weren't going to use webSocket, then there is no other cross-browser method to "push" data to a browser client. Your only other alternative I'm aware of would be browser polling which isn't actual push, but tries to simulate push by just regularly asking the server if the server has anything new for a particular client. An enhancement to straight polling is "long polling" which was invented before we had actual push with webSockets.
All of this problem has already been solved in socket.io so unless you really just want your own research project to rebuilt similar functionality in your own code, you may as well build on solutions that have already been done by using something like the socket.io library.
If you have some specific objection to the socket.io library, then please explain that objection so we can understand what your real goal is here.
Node.js doesn't come with an out-of-the-box server-side Websocket implementation, so you will have to, at least, introduce a package which does.
If you don't want to go with socket.io, you can then defer to ws, which is what socket.io uses under the hood.
I'm using node.js+socket.io in my projects, and one of the issues that bothers me the most is absence of normal AS3 library than can handle communications between as3 and node.js using socket.io.
In my last project, I used https://github.com/simb/FlashSocket.IO this library, but I had to roll back to node.js v0.8.25.
So - requirements:
Works with node.js v0.10.x
Works with socket.io v0.9.x
Secure connection support (wss)
It would be nice to have more than one library, maybe someone knows a better one?
Thanks!
I also needed this, so here's what I used: https://github.com/sinnus/socket.io-flash.
requires Socket.IO(>= v.0.8)
I have written a small site where the main focus is users can create chatrooms for themselves. I've used socket.io and wrote everything myself, trying to get something working.
The site is now out and it turns out my solutions are horribly unreliable. Users complain about messages swallowed, sudden disconnects without notification, some users are logged in 6 times in the same chat, etc etc.
Maybe someone has some example software, open source, that implements a multiroom chat with node.js and socket.io that is ready for production.
I also begin to think that forever start is maybe not the intended way to have a node.js server running.
Have you looked at the available chat source code: http://chat.nodejs.org/ ?
Good place to start.
One of node.js' primary examples is a chat functionality.
You may also check out the modules on github: https://github.com/joyent/node/wiki/modules
There are quite a few frameworks already built for chatrooms.
node-simple-chat is a node.js / socket.io realtime chat.
Or check out Now.js, it also has a guide/example for a chat.
Here you may find a tutorial and sample code to start with - http://blog.denivip.ru/index.php/2012/11/how-to-develop-highload-services-on-node-js/?lang=en
We used socket.io in one project and ended up with custom transport implementation due to some socket.io bugs (sockets management & poor Internet handling).
I pretty much don't know anything about these two. Which one is better/more efficient and why?
Also I looked at the node.js example and noticed that they create a server for the chatroom/chat.
Does that mean I need to create a new server for every chat/chatroom or is there a better/more efficient way of doing this?
Thanks!
Socket.io is a library which utilizes node.js. Think of node.js as an javascript on the server. Socket.io provides modules for websocket servers (server-side) and websocket clients (client-side).
I do not entirely understand your question about creating a new server for every chat/chatroom. That's entirely up to you.