I am at a loss. recently i have started learning Spring MVC by creating a web application that will post live updated sports scores. the business logic is basically done, but i have no idea how to create the web view. Specifically, Is there anything available that will allow the view to automatically refresh asynchronously from within Spring? If i want to do a refresh of the scores listing anytime new data gets added to the connected database, is that something that can be done with some sort of ajax dependency/ templating engine?
what about Angular.js or some variation of Meteor.js (atmosphere)? As you might tell, I'm pretty confused on how the web layer works..
any direction would be greatly appreciated.
You could use Websockets to broadcast data to connected users as it gets added to the database. With a PubSub pattern you can additionally limit the amount of messages to only the ones your client is interested in eg. filter out scores of non-visible games.
https://spring.io/guides/gs/messaging-stomp-msgsjs/
Related
I am trying to build a website that allows coordinators and teachers to be able to login with separate logins and see the same page at the same time on different computers (it is interactive). Do you know what platform we could use to do that? Any insight would be great!!
For example, a teacher would press a check next to a goal they think they met, and their coordinator would see that on their computer immediately, and press a checkbox and their side regarding whether they met the criteria.
The platform could be any web server language. The javascript framework express.js which runs on node.js is very popular.
You'll need some javascript to send the goals to the server.
You'll need a database to store the goals. Mongodb is popular.
You'll need code to set and get the database goal objects into web layer goal objects.
You'll need a template engine to render the web layer goal objects as html and some more javascript to update all clients screens when a goal is checked.
I am trying to write a web application that displays to users a hierchical tree. Users can add,delete, and update the tree but the tree should look the same for all users. My first thought to save the state of the tree (i'm using JSON to represent the data in the tree) in a database but, what happens if there are a million/billion/etc number of people using the application? How do you make sure that all users are physically seeing the same thing if additions/updates/deletes could be going on simultaneously?
Something like signalr would would help:
http://signalr.net/
What can you do with ASP.NET SignalR? 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.
It also enables completely new types of applications, that require
high frequency updates from the server, e.g. real-time gaming.
I'm having some trouble appending content from the database to the view when new content is added to a specific table. Currently, every number of minutes the database is updated with new content by a cron job.
The goal in the end is to have the page displaying this content being added to the database to display the latest content without refreshing the page. The only way I can think about how this could be done is with AJAX. I have looked into Railscast 229 where they talk about how to do this but it wasn't making a lot of sense.
If seeing code samples will help then I can provide some of that as well.
Thanks in advance!
With a typical multi process rails setup polling ist your best option.
There also 2 alternatives. Websockets and Server Sent Events which can be used with multithreaded or evented (NIO) deploys.
In both cases there is long open connection between the browser client and the servier, through which the server can publish updates, the client subscribes to. Server Sent Events are actually pretty easy in rails. Checkout Mini-chat with Rails and Server-Sent Events
See also this answer about different types of concurrency models
We have a new build requirement that needs to work as follows:
the functionality of the App is that the maintains data related to tasks assigned to the User
the App needs takes data in the form of XML via WebAPI, the XML is a list of tasks for the User has been assigned. This would be a task bundle
once the XML is downloaded the User can work offline, i.e. they need to be able to maintain data related to their tasks, the data needs to persist on the phone, tasks would be completed over time in different sessions
there can be a number of current taks bundles "on the device" for the User
when online the App can submit an XML back up to the server, the purpose of this is to communicate the data entered by the user for the task bundle
If this was an online app it would be fairly straightforward, the data resides on the server. I have done a lot of research on the web with regard to the best way to build the app to satisfy the requirement that the App works on all browsers and platforms.
We're thinking of going with HTML5 & JayData. Haven't made any firm and final decisions, so would welcome any suggestions and constructive comment.
I work for JayData. If you have concerns against JayData just let us know and we'll try to answer.
Probably this article will help you to start your online/offline app - How to create a synchronized Online/Offline data application with EntityFramework, JavaScript and JayData
I'm trying to build a single page web app using Backbone. the app looks and behaves like a mobile app running on a tablet.
The web app is built to help event organizers manage their lists of people attending their events, and this includes the ability to search and filter those lists of attendees.
I load all attendees list when the user opens the attendees screen. and whenever the user starts to search or filter the attendees, the operation happens on the client side.
This way always works perfectly when the event has about ~400 attendees or less, but when the number of attendees gets bigger than that (~1000), the initial download time takes longer (makes sense) .. but after all data is loaded, searching and filtering is still fast relatively.
I originally decided to go with the option of fully loading all the data each time the app is loaded; to do all search operations on the client side and save my servers the headache and make search results show up faster to the user.
I don't know if this is the best way to build a web/mobile app that processes a lot data or not.
I wish there's a known pattern for dealing with these kinds of apps.
In my opinion your approach to process the data on the client side makes sense.
But what do you mean with "fully loading all the data each time the app is loaded"?
You could load the data only once at the beginning and then work with this data throughout the app lifecycle without reloading this data every time.
What you also could do is store the data which you have initially fetched to HTML5 localstorage. Then you only have to refetch the data from the server if something changed. This should reduce your startup time.