Open ethnt opened 11 years ago
I'm using the topic branch 253-ajax
.
Here's the routing.
/api/theme.json
/api/schedule.json
/api/marquee.json
/api/notices.json
It only returns data for the current values (i.e., the current schedule, etc).
(Just FYI, WebSockets was borked in iOS 6, so it won't work on those devices.)
AJAX doesn't use WebSockets. It's basically back and forth POST data using XMLHttpRequest in JavaScript. jQuery has a pretty sweet lobrary for it, and support for passing JSONs.
The way that the refresh works is that it uses Faye, a library for WebSockets. That's how it's triggered.
This will help with #247, as we'll just be caching the JSON data.
As part of #261, we can send JSON data along with the refresh request. Fill the page with the new data (dynamically).
Here's the plan:
Does the installation guide include instructions on setting up Padrino? It doesn't look like it, and I don't have a ./bin/safe file after completing the instructions.
That wiki is quite old, I need to update it.
gem install bundler
then bundle install
./bin
directory doesn't exist anymore. Assuming you have MongoDB (sudo mongod
) and Redis (redis-server
) running, you can just run bundle exec foreman start
to start a development server at http://localhost:5000. However, at this point, it won't run without Amazon AWS S3 credentials. I'll explain that tomorrow in school.I'll update the wiki soon and make it easy to run it in development. Eventually it'll be just running online, with the back up in AV, so maintenance won't be much of an issue.
Ethan, I apologize for the late work on this. Robotics has been taking up a lot of my time. FRC Build season will end on February 19th, so I will have my life back after that day....
It's quite alright. Whenever you get around to it, make sure you make it in the topic branch 253-ajax
off of the branch refactor
. I'll start working on this soon (this could be related to #296 — perhaps this will reduce the CPU load).
I'm at the AWS issue now. :(
/home/gluxon/.rvm/gems/ruby-1.9.3-p385/gems/fog-1.9.0/lib/fog/core/service.rb:208:in `validate_options': Missing required arguments: aws_access_key_id, aws_secret_access_key (ArgumentError)
Ah, you need to create a .env
file with your S3 credentials:
S3_ID=YOUR-ID
S3_SECRET=YOUR-SECRET
S3_BUCKET=BUCKET
To get the ID and SECRET, create an AWS Access Key.
You also need to do the same for Pusher, except with PUSHER_ID
, PUSHER_KEY
, and PUSHER_SECRET
.
What's your preferred method of communication? GTalk? IRC? I have questions and don't want to spam this issue.
GTalk, ethan.turkeltaub@gmail.com.
Here's how I want to implement this.
I think that we should just latch onto what we're currently using for refreshes (Pusher). Since you can pass any data along with the request to Pusher, we can put the current data in there. We then check that against what is currently on the clock and figure out what needs to be changed.
On Tuesday, June 25, 2013, Brandon Cheng wrote:
Here's how I want to implement this.
- Get /api/status/status.json at an interval we can argue later (3 sec?).
- Check last_update_key and compare with a previously obtained key
- If the keys are different, grab a json of the new schedule/marquees/notices
— Reply to this email directly or view it on GitHubhttps://github.com/fhsav/clock/issues/253#issuecomment-19994000 .
Ethan Turkeltaub http://ethnt.me @ethnt http://twitter.com/ethnt
Meh, I kind of want to remove this external dependency on Pusher.
Requesting a page every n seconds puts too much load on the server. PubSub (like Pusher) is made for this. Another library like it is Faye, but I'm not sure if it'll work on Heroku.
On Tuesday, June 25, 2013, Brandon Cheng wrote:
Meh, I kind of want to remove this external dependency on Pusher.
— Reply to this email directly or view it on GitHubhttps://github.com/fhsav/clock/issues/253#issuecomment-19994308 .
Ethan Turkeltaub http://ethnt.me @ethnt http://twitter.com/ethnt
In fact, we don't need to have any of the logic that determines what needs to be changed on the client-side—that can be handled server-side and then only the new data is sent along with the Pusher/Faye request.
On Tuesday, June 25, 2013, Ethan Turkeltaub wrote:
Requesting a page every n seconds puts too much load on the server. PubSub (like Pusher) is made for this. Another library like it is Faye, but I'm not sure if it'll work on Heroku.
On Tuesday, June 25, 2013, Brandon Cheng wrote:
Meh, I kind of want to remove this external dependency on Pusher.
— Reply to this email directly or view it on GitHubhttps://github.com/fhsav/clock/issues/253#issuecomment-19994308 .
Ethan Turkeltaub http://ethnt.me @ethnt http://twitter.com/ethnt
Ethan Turkeltaub http://ethnt.me @ethnt http://twitter.com/ethnt
Faye and Pusher are still checking for new data every n seconds. Is there a reason why Faye hasn't replaced Pusher in the code then?
Infrastructure (Heroku has some trouble with it, so does Passenger). You can look at some previous commits to see how Faye was implemented before (look at v0.4.0 in the tags, maybe).
On Tuesday, June 25, 2013, Brandon Cheng wrote:
Faye and Pusher are still checking for new data every n seconds. Is there a reason why Faye hasn't replaced Pusher in the code then?
— Reply to this email directly or view it on GitHubhttps://github.com/fhsav/clock/issues/253#issuecomment-19995425 .
Ethan Turkeltaub http://ethnt.me @ethnt http://twitter.com/ethnt
Use JSON and Ajax to refresh, instead of just refreshing the whole page.