I'm using mongodb with mongoose and node.js with express.
I'm building a communication platform where users can post suggestions for certain other users to view and respond. If two users are using at once, is there a way for there to be live real time updates of new suggestions. I know I can use websockets for this, but I was wondering what standard practice is without websockets. If someone could point me in the right direction that would be great. I've only been coding for 6 months, so I'm still learning! Thank you.
socket.io
it uses websocket when possible. If browser does not support it.long polling is used
But you write the same code once for all situations. it handles them for you
Related
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 )
I am writing a nodejs / express / mongodb based web application and all is working great.
What I've made for learning purposes is a twitter clone.
People can tweet whatever they want and it will show up on their profile and anyone who follows them stream.
On my home page it shows everyone who you are followings posts.
I want this stream to automatically update when someone they are following posts something new.
So they can just sit their on the home page and see all new posts come in in real time.
I've worked with Socket.IO in the past and loved it for it's awesome simplicity of use.
But is Socket.IO an appropriate use for this sort of situation?
Are their better options I can use, perhaps going with a simpler approach of AJAX polling would be more efficient for scalability?
So basically what is the best to use for an application like this?
I need:
Realtime updates to the client
Scalability and effeciency
Thanks!
You have multiple option
My firstoption RacerJS
and Socket.IO
Get data from mongodb and send through racerjs or socket.io
RacerJS is synchronization model built on top of ShareJS, which has underlying technique called Operational Transformation, this is used to do collaborative work on the same data in real-time (like Google docs) I guess it does not really apply to your case or its not the case where it should be used. Because ShareJS does a lot of work to keep clients able to edit at the same time on the same data. This is not the case with Activity streams like your case.
A good option would be Meteor
I'm Developing (yet another) Node,js + Express + Socket.IO Facebook/like Instant Messaging app.
The server-side is mostly complete, but I was looking for a proper way to store and retrieve conversations and I thought I could give MongoDB a try.
I've never worked before with noSQL databases before, so I would like some suggestions on how to deal, mainly, with the writing the proper way.
I was thinking in creating entries containing the user chatting and the chatlines with a timestamp, something simple.
Any thoughts?
Though this does not exactly address the app you are looking to build, 10gen (to company that supports mongodb) has released a video of a presentation walking through the creation of an IRC chat server. This is a very long and very extensive presentation and should cover most of the material that will be relevant for you in building your app. Definitely seems to me like the best resource for you to get started with.
http://www.10gen.com/presentations/mongonyc-2012-building-mongodb-power-chat-server
Hope this helps!
I want to implement newsfeed for followers just like Twitter in realtime. But I'm stucked which tools will be the best for my purposes. The solution (complexed solution) should be production-ready. I've tried node.js + socket.io + rabbitmq (node-ampq, rabbitJS), but node frequently crashes... Another solution is Tornado + sockJS-tornadio, but I'm unsure (and know Python not good). Before diving into code, I just need to know which tools are ebst for my purposes and can be 'really' realtime. By 'really' I mean trully fast request-responses. I've tried RabbitMQ + PHP API + Ajax, but it's not 'really' realtime, it uses ajax instead of, for example, websockets.
The data for newsfeed will be like 'John updated its profile', 'Doe uploaded new file' and something similar.
Thanks!
What sort of crashes are they? Node has been fairly stable for some time now, at least for me.
Node is a fine solution, but you introduce some amount of complexity with communication between Node and PHP (which you look to want to solve with RabbitMQ). "Really" realtime can be easily accomplished with socket.io, and since it has multiple fallbacks is ideal for getting a wide audience. Long polling and friends do have their overhead but it isn't too much if the events aren't very frequent.
If it's easier for you to integrate the newsfeed into your PHP program and you are willing to accept the minor overhead I say go for it. Otherwise, I would invest in Node. The platform is still young, but it's matured well, IMO.
I just build a realtime web application.Users can drag items and chat in the same page.and I use tornado + jquery pending + redis as a MQ system.It works good, but I am considering to try socket.io to handle realtime requests.
tornado is kickass in terms of performance, and really easy to work with. the only problem is that you need to make sure you have adapters for databases and other blocking-by-nature sources you need to communicate with. It supports websocket of course so you can stream data to users.
If I had to implement this today, the stack I'd use is:
Redis for the data and pub/sub on channels.
Tornado as the API server.
WebSocket for the communication layer wherever possible.
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.