I'm working on an app that has a mobile component and a web component. The web component is going to be used by a certain group of people, while the mobile app is used by everyday people. When the script is run from the mobile device I want the web app to update using ajax. Kind of like Facebook mobile, if you post a comment on mobile to your friend, and that friend is on their laptop, they will still get the notification in real time. How is that possible. The script works, but the users on the web app won't see it unless they refresh.
1条回答 默认 最新
- ~Onlooker 2013-09-07 15:46关注
I suggest setting up a NodeJS server, and have active users connect to that. You can then push notifications to that server, which in turn sends it out to the clients. It won't matter if the client is on desktop, mobile web or even in a native app. SocketIO greatly simplifies this for web-based applications. See http://socket.io/. It also has fallbacks in case the users browser does not support web-sockets.
There are of course other options, but for web this is the easiest in my opinion.
解决 无用评论 打赏 举报