i'm actually using Codeigniter framework.
I was planning to make a simple real time notification system for website users.
The fact is i can see websockets etc .. all new awesome stuffs are not really supported all over the browsers and devices, for example Android mobile is really cutted off.
So , what i'm wondering now, which is the best way to go, best
envoirment to plan for making real time notifications using PHP and
Mysql (I can only use Mysql db no others)?
at the end which techonologies/frameworks/languages to involve to achieve this?
If you use a CodeIgniter Framework, here you have a good tutorial. Click here and read it. It will help you to use nodejs, socket.io and CodeIgniter together for live updates.
Update
Node.js documentations here
Related
I went through several topics on SO but I am not sure what fits my needs as I am newbie.
I am creating an Android application for my website.
I reckon that the users can be over 800000 online at the same time.
Users will be able to:
- Submit data through the application
- Read news and updates
I want the updates to happen in real time..
The question is what approach or technique should I use?
In some SO topics is mentioned that there should be on the server side some php files that will accept http/post/get requests and they will return JSON data as feedback.
Is the above-mentioned a proper technique to serve a huge amount of users at the same time(for my standards "huge" means around 800000 users at the same time)?
I recently came across node.js. From what I read it seems like it can act as service where a user/ app can request or post data.
Can anyone give me a suggestion or links where the things are clear? How can I make sure what approach is the right one for my application?
Whatever the case is can anyone describe the right way of doing this thing?
For example: How Android chat aplications suchs as whatsapp, facebook etc work? How they do it?
I do NOT want you to post any code.. just ideas!
Thanks in advance!
If you want create an app like Facebook, Snapchat ... YES you must have a WebService, an API.
The API is linked with your database like your website and return to the app JSON, with the content of your app.
Your API (web service) can be programmed in various language as PHP, Node.JS ...
If you want to know Facebook had their API in PHP before that they created their own language.
Some other app have their API in other language.
I don't really know what is THE BEST language, the BEST language is the language which you are good with, and know it.
I think think nodejs will be best option.
NodeJs is helpfull when there are large number of clients.
Nodejs works best when building chat and gaming applications.
I think this link will help you a lot to learn nodejs.
If you are asking how facebook and whatsapp works they are implementing websockets which provides bidirectional flow of data helps in real-time communications between clients.
If your scenario is sending chats back and forth nodejs is a really good option, Most of the online tutorials you will find about nodejs develop a chat application and its super easy to do so with nodejs. Infact the biggest catch with nodejs is its easy configurations and deployment plus its lightweight. However it might be a good idea to have a look at XMPP as tech giants such as whatsapp use it to send messages and maintain presence. This link can be a good head start for nodejs learning http://code.tutsplus.com/tutorials/nodejs-for-beginners--net-26314
I need to develop a web application with a chat feature, and I would like to know if there are any sophisticated ways to create a realtime web-application with a push engine.
I know jQuery, and I can handle to create a chat web-application which, in the client side, check every period for new messages, and show them, but I don't like this solution and I was wondering if there are any better ways to do it.
In my research I discovered the existence Ajax Push Engine project, and it looks like what I need, but when I was navigating in their website I found it not very well done and somehow incomplete, so I was wondring if there API is stable enough to be put in a production environment if not are there any other solutions?
Sorry if I made it long, any help/hint/link/suggestion would be very welcomed :)
EDIT
I would like to specify that I'm working with PHP in the server side
Here is an implementation in NodeJs.
http://dhotson.tumblr.com/post/271733389/a-simple-chat-server-in-node-js
I recently (year 2012) developed an application in ASP.NET MVC3 where I used SignalR for real-time messaging between server and client. At their own site, they describe SignalR like this:
ASP.NET SignalR is a new library for ASP.NET developers that makes it incredibly simple to add real-time web functionality to your applications. What is "real-time web" functionality? It's the ability to have your server-side code push content to the connected clients as it happens, in real-time.
... and they give the following example of what you can use SignalR for:
SignalR can be used to add any sort of "real-time" web functionality to your ASP.NET application. While chat is often used as an example, you can do a whole lot more. Any time a user refreshes a web page to see new data, or the page implements Ajax long polling to retrieve new data, is candidate for using SignalR.
Further, based on my experience, I believe it is very simple to set up, easy to use, and have a good github page with well-written documentation that gets you going in no time. I can highly recommend it :)
If got a task to create a mobile application for iOS, Android and WP. This application needs to access a mySQL database which is already in use by the website running php.
What I found in the meantime, is that I have to create a php webservice and use this webservice to access the data in the mySQL database.
Since I did not found any clear advice which way is the best to do it (JSON, XML, REST, etc) - I just wanted to ask you, is there a kind of best practice which technologies should be used for the php webservice?
Additional it would be great for me if someone knows a good tutorial for the recommended technology.
Thanks a lot.
I am arriving a bit late but here is my answer : I believe that the easier way currently available is a PhoneGap application (with Sencha Touch or jQuery Mobile as a javascript framework) talking to the server through a simple PHP webservice. PhoneGap allows you to build an Android, iOS and WP app with the same codebase.
We use that technology in my company and it works great.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have had a PHP application developed. I want to use phonegap.com or a similar approach to develop native applications based on the same MySQL database. In other words, connect the mobile applications with the web one.
It needs to do one or two things differently. Firstly, use the native GPS features to determine where a user is - I'm guessing this can just be done via HTML5?
Secondly, send push notifications whenever the web-application user receives a notification.
All of the information is already there, on the MySQL database, and everything apart from the two features above function properly.
I'm am currently having an API developed for everything on the web-application - making it API-centric. In my head, it will be easy to connect the two versions via the API.
For example, a user signs up on the web application. He is then offered to iphone app for download.
Is it possible to get him to log-in with the same via the iPhone. On the other side, is it possible for him to search the database, via the iphone, and "add a new friend" - making the connection of the two users in the friends table - in that, the friend is also a friend on the web-application?
I've been reading a lot on all of the available options and am still very confused! Any help would be very helpful.
I'm not a phone developer myself, however I've just finished building a native Android App which connects to a website and is able to login, do stuff that is possible to do on the website as well. If the GPS tracking integration is using the native features than it is unlikely to use HTML5 (though I'm not sure how it works).
Basically in order to connect to a remote database/server you need to make HTTP requests from the phone to you server side script.
So just to conclude:
In order to achieve the result you're looking for the work-flow could look like this:
1.Mobile user fills a form ->
2.App does an HTTP request to a server side script ->
3.script does the hard work (e.g. connects to the database) ->
4.script renders a result ->
5.Mobile app displays the result.
I hope this helps.
Im my objective opinion there are three possibilities:
Get started with Objective-C
You will have to learn how to code and you will get the best native experience for your users. This will easily allow you to use the GPS positioning or you can cache content on your phone. A key problem with the internet connection on the phone is that the internet connection can be flaky. So you have to design for this. You took the right approach already: using the direct MySQL C-API to connect directly to the database server would not work that well, because this protocol is not stateless. You have to first login to the server and then you can send your SQL queries.
By using your API which is hopefully stateless, maybe even a RESTful API, then you can take some nice shortcuts for your native iPhone app. You could then use the RestKit library to easily convert your JSON answers from the server into objects, do caching and other nice features.
Write a web app
The second possibility would be to build a nice web app using state-of-the-art HTML5 technologies. The great thing about that is that you then would write an Android app as well as both mobile devices use a webkit browser. Well it is not exactly the case as there are different versions of Android out there with different screen sizes, but in general this assumption holds. Take a look at Google's web app for Google Calendar for example, I think it is a good compromise. You can also get a home screen icon for this and you will have no app approval process and can update anytime. Using HTML5 offline storage gives you some degree of freedom.
Using Phonegap
The option of writing the app in PhoneGap or some other HTML wrapper framework which will generate Objective-C code is a possible one, but in my opinion this is not really a good option. The reason is that you are working on some kind of intermediate layer and if anything goes wrong or you encounter bugs you will have to dive down to objective-c anyways. The other problem is concerning updates of iOS. It can break some dependencies and then you have to wait until your intermediate gets updated to use the new features.
Phonegap would be a good idea to develop this app. Phonegap although supports client side script only - which means you cannot embed php in its code. However you can easily create AJAX calls in your script that get and send data from your already developed php app/api.
Phonegap also supports GPS and data storage options where you can store the data locally and sync later when internet is available.
For reverse sync (server to client), you would have two options.
1. Create a javascript to make frequent ajax calls to check for updates.
2. Use Push Notifications (Here a tutorial for iOS APNs and Phonegap integration) - http://devgirl.org/2012/10/19/tutorial-apple-push-notifications-with-phonegap-part-1/
Using phonegap depends on one's preference. On the positive side, you save on time/cost as same code is used for all platforms. On the negative side, it has a slight lag when changing pages causing it to look like a website, but you can avoid that by using something like jquery mobile to prefetch all pages and then animate them back and forth. This will also help in uploading data in a separate independent thread while the user would be free to roam around the app.
Hope that helps.
Simply put, the best way to go is for you to use a php web service with phone gap.
You can also go through android using PHP and android. This is a very good and simple way to go. Try the tutorial here
You may tray Xamarin (part of .Net) with the free version of Visual Studio Community and then interact with your PHP web-app. You can then compile the native Xamarin app (written in C#) to Android and iOS.
I will be working on a project for my friend. It will involve handling real time user data. Like SO, I would like to let a user login with his/her OpenID. I want advice on
MySQL db engine and or design for a real time system
authentication mechanisms
I am good at CodeIgniter and chances are I will be using it, any other suggestion
jQuery has most supporter/users here on SO and I am comfortable with jQuery as well as Prototype, out of these two which one is better or there is any other competitor to these?
The system will have users, who will be using a stand-alone client that will communicate with centralised server, one can have a view of this data on web front end.
Similar Question : Is there a way to have PHP print the data to a web browser in real time?
Javascript library is your choice.
For real time web applications trends like WebSocket, Server-Sent Events are not supported across all platforms.
You might consider checking Push Technology, Comet. Hope this gives you some direction.