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 )
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 so often see titles like "Node.JS + socket.io tutorials." Even in the Node.js Beginner book I've purchased, it tells me to download socket.io so I'm getting really confused.
What's the difference between them? Why can't I code my applications just with Node.JS "OR" Socket.io? If I can code, why do people socket.io plus node.js in titles?
I'm really confused so any kind of replies would be appreciated.
node.js is a platform.
socket.io is just a framework for dealing with websockets if your are building an app on top of node.js.
socket.io needs node.js but node.js does not need socket.io
EDIT: Ryan Dahl's (node.js's creator) intro video is really instructive and helps with this kind of confusion: http://www.youtube.com/watch?v=jo_B4LTHi3I
Socket.io is a framework on node.js for realtime applications. So, both is required if you want to use socket.io. You can code your own to do the same thing but socket.io is cross-browser and by using it can help you save time.
socket.io is a library, addition to actual platform which is node.js.
It is like a software to computer. You can't use software without computer.
Node.js - is platform, that takes care about language - JavaScript visualization using V8 (JavaScript Engine that interpret JS script to understandable form to the computer). And lots of other components of platform.
While socket.io is just using features of platform, implements some cool own features that are addition to node. It is just a library, addition that you use along with the core.
In real world its like hoover - is a node.js, and nozzle is socket.io. Of course it is rough example, and things are much more complicated. But as you can see, nozzle is pointless without core.
Node.js makes your JavaScript running using own features. While socket.io is something you use or not - by your choice.
I am also learning nitt- griities of nodejs , socket.io , express etc . What I have understood so far is that Nodejs is the big backbone of hosting the entire project ( could be both on client and server's end ) with the node command like > node servercode.js etc . It can open ports for websockets server , Http server even https server .
However socketio provides the communication link between the client and server side in an asynchronous event driven manner ( think ajax ) .
Hope it helped
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 have just began working with node.js and have gotten the hang of the basics.
Right now I'm trying to see if I can create my very first real-time web application using node, during my research I have seen modules like "express.js" and "socket.io' pop up very often as frameworks used for node web apps.
My question is; do I really need to learn these two in order to make real-time production level node.js applications?
Also, what other things should I look at? I heard about tempting engines being an asset, but 'm not sure of their use.
You don't need to use any modules but you give up a lot when you don't. Express.js is a great place to start. It has good documentation and makes the whole process much easier. I use jade and stylus for my css and templates.
Socket.io is again optional but if you are doing real-time updates it sure makes things a lot simpler. Socket.io deals with all of the browser differences with one api and the client will always connect using the fastest technology.
Socket.IO is mandatory for real-time applications. If you have to implement a chat, a broker, a server status tool or something like that and other natural real app, you must consider use this Node package. If your site do not require something real-time bi-directional message handler you just avoid the usage of this tool.
In case of all application needs to be made in real-time situation, you can see a more appropriate framework to approach it, like Meteor
I've build several websites using PHP and mySQL as backend, and believe that I'm fairly familiar with both. However during research for my new website I've come across node.js and mongodb (and socket.io, since the site is gonna contain a chat).
I've decided to use node.js and mongodb to run the chat - but don't know if I should just do the entire site with those two things?
Since I'm gonna run a node server anyway should I just run another (seperate) one hosting the website? Or is that an bad idea? - is it stable?
I could do the programming in PHP and still be using mongodb - but wouldn't node be way faster?
And another question:
I've planned to use ajax to handle all the posts to the page - but since I'm allready using socket.io to the chat - should I do all my post request using that?
For the ajax I've planned to use jQuery (also for all frontend effects).
don't know if I should just do the
entire site with those two things?
If you want to learn node.js then there is nothing better than coding it.
Since I'm gonna run a node server
anyway should I just run another
(seperate) one hosting the website?
You can use existing server and run your node.js app on other free port(o). I think for learning node you don't need to have dedicated machine.
is it stable?
Even versions of node.js are stable releases, however until there is 1.0 with feature freeze there could be breaking changes to its API.
I could do the programming in PHP and
still be using mongodb - but wouldn't
node be way faster?
It most probably (and definitely) would.
I've planned to use ajax to handle all
the posts to the page - but since I'm
allready using socket.io to the chat -
should I do all my post request using
that?
I would recommend stick to MVC model and use express since you can get into lot of time consuming troubles if you would use socket.io for classic stuff. Socket.io is namely for real-time functionality and things related to that.
There are already some solid web frameworks for node.js, in particular check out Express. Here's a really good article outlining some lessons and experiences from building a node.js website:
What it’s like building a real website in Node.js
Regarding your second question, it's probably still best to use AJAX handlers and HTTP with jQuery. I'm not sure that jQuery supports callbacks over raw TCP sockets.
node.js + express + jade + stylus + jQuery is my preferred environment.
Using forever to auto restart the server I've never had any real up-time issues even when I have bugs crashing the server on a regular basis.
As for socket.io + jQuery, they do get along fine, but it's just not as natural as the express + jQuery combo. I'd stick to making ajax calls for most things.
Node.JS can still be a little wild west like, but its improving. It is a very different model from coding in php, but it is very well suited for a lot of websites. You'll probably want to do the thin server (expose a REST API and your websocket endpoints) with a fatter client using something like BackBone.js to keep interactions clean.
The big win from doing the whole thing in node is that you will not have duplication of code between php and js for dealing with the DB or any other services required by both. Node.JS is also fantastic at handling tons and tons of concurrent requests.
Good Luck