Socket.io multiroom chat examples, ready for production - node.js

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).

Related

Signaling mechanism for webRTC using simpleWebRTC js library and backend in django

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.

Django channel vs node socket.io

I want to develop a real time chat application and also want to show real time graph/chart.I am confused to choose technology.I heard a lot of good things about nodejs socket.io and also heard about django channel.Can you suggest me to choose from one of them for my project?
There need a special feature though.I need to run a cron job to get data from external web service and broadcast it to all clients.
Thanks in advance
Django channels is fantastic at broadcasting and creating a chat application. I have successfully used Channels with Websocket and Redis to create a chat application. I am not sure about scalability, but since you're here with this question there may be a chance that your app may not reach a large enough usage frequency to make that an issue.

websockets vs express.io

i am looking for a very lightweight framework that can very simply pass data between browser and the server. i started looking around for a possible alternative to express & socket.io and came across express.io and have a couple of questions:
1) when i look at express.io on github, it would appear that there has been no activity for a couple of years. should this be of any cause for concern? from my newbie perspective, i would think that one wants to strike a balance between stability and something that might not be under active development anymore. but i am only guessing.
2) websockets looked very interesting and i see some very recent activity there. any thoughts on if this is a good replacement for socket.io ? our application will only be running on a new html5 browser.
i have looked at quite a few possibilities (layers, kaph, locomotive, stapes, hapi, etc) but i wanted to stick closely with something that was more sinatra-like, very similar to express. i also thought perhaps i should look for recent development.
or could it be that there is really nothing better than the original socket.io & express ?
thank you very much.
socket.io is built on top of webSockets. It adds a bunch of useful features that webSockets do not have such as automatic reconnection, structured message passing, etc...
So, one would only really go back to webSockets from socket.io if you had no use for any of the extra features that socket.io adds or if you need to be compatible with some other endpoint that is only a webSocket and not socket.io.
As for express.io, here's one such discussion of a similar question: What utility of express.io VS express + socket.io?. The fact that there has been no development on it in a few years and that the domain it was using has expired seems like it is no longer being supported unless there is some other fork that is being developed. I don't know express.io very well myself, but it appears to be just be some extra glue that allows you to capture socket.io messages using express-like route definitions. It doesn't appear to really offer new capabilities that can't be done with just express and socket.io.
For you to get much else in helpful advice, I think you'd have to describe a lot more about your requirements and why express + socket.io doesn't already meet your needs.
https://pusher.com/ is a really nice software as a service that accomplishes this functionality. It's similar to socket.io and also runs on webSockets. There are a lot of other services like that out there. Pusher's free tier is not too bad, and you likely won't run over the hard constraints unless you're making enough money to pay for the premium tier of service. Their libraries are also super easy to understand.
socket.io is still a great choice, just wanted to show you that there are more options out there.

Ionic app with node.js server

Hello !
A bit of background, I'd want to create my first android/iOS/webapp. The idea is to create a cross platform chat using :
Ionic (and Javascript) for the app
Openshift for the node.js server part
I was going to use Firebase to store the messages, but the free plan just works for 100~ simultaneous users, which ain't a lot ... So I was thinking about creating a node.js server using MongoDB to store everything. Users and messages.
The idea is that I'd get a better server side control on the data, and it seems to be nicer to me.
But is it actually a good idea ?
I'm not sure about the fact that it's pertinent to use a node.js server for that matter, I'm pretty new to those technologies (I'm a Java/COBOL developer)
Thanks in advance !
tl;dr : is storing and processing data for an iOS/Android/Webapp chat with a node.js server is a good idea ?
I think it's a good idea, in few hours you would have a working environment. With Ionic, being web technologies, you can use any library you want, probably the easiest one to use could be socket.io, is simple to use client side and simple server side. You would have rooms and everything already to exchange messages in realtime.
There are a ton of examples for using socket.io to make a chat so should be pretty easy to find infos. ( I made one myself )

chat application: node.js or APE?

I want to create a chat app which would use php/codeigniter to do the views and user interface. I've been reading lots of posts on stackoverflow which recommended node.js or socket.io. Yet I've also run across APE(Ajax Push Engine). I don't really know much about either and was wondering which to use.
I read up on node.js and saw lots of good things about it, but the major thing about it that worries me is that it's relatively new and doesn't have lots of real world websites testing/using it.
On the other hand, APE does. And it looks similar to node.js. But like I said, I don't know enough about either to know which one to choose.
Which one is better at creating a chat app?
Thanks!
I played a little bit with node.js, tried out socket.io - but in the end did a big project with APE.
I think, as always, there is the question of what you want to achieve. Only comparing the server parts: With node.js you get a machine that won't do anything on it's own, you need to write it yourself (or use libraries) With APE, the handling of channels and connections is already built in (compiled C). Still you need to build parts of your own logic on top with JS - or use the examples.
On the client side, socket.io provides a client framework with three commands - and APE has it's APE_JSF that handles the connections (which brings more functionality than socket.io regarding channels)
Personally, I prefer APE, even though there is a lack of documentation for beginners. However, keep in mind that APE won't deliver files/images, it's not a full Web-Server but optimized for real time push where it can handle ~10K concurrent users
Like you, I'm not familiar with APE, however socket.io on node.js comes with a chat app as it's main example app.
True, there aren't a lot of sites using Node.js right now. Socket.io, however, is probably considered Node's 'Killer App', and thus has relatively a lot of talk/work done with it.
I'm presuming APE has stable APIs, though, which socket.io might not necessarily have - The 0.7 version was a pretty broad, API-changing update, for example. This might happen less often with the publication of the socket.io spec.

Resources