Skip to content

Commit

Permalink
Merge pull request #7 from liquiddc/master
Browse files Browse the repository at this point in the history
Pull liquiddc changes in to IE branch
  • Loading branch information
Floppy committed Jun 23, 2014
2 parents 039d8f9 + 505521b commit 3bca71e
Show file tree
Hide file tree
Showing 6 changed files with 494 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dashing.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |s|
s.name = 'dashing'
s.version = '1.3.2'
s.version = '1.3.x'
s.date = '2013-11-21'
s.executables << 'dashing'

Expand Down
3 changes: 2 additions & 1 deletion javascripts/dashing.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ Dashing.debugMode = false

source = new EventSource('/events')
source.addEventListener 'open', (e) ->
console.log("Connection opened", e)
if Dashing.debugMode
console.log("Connection opened", e)

source.addEventListener 'error', (e)->
console.log("Connection error", e)
Expand Down
11 changes: 11 additions & 0 deletions lib/dashing/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,19 @@ def protected!
get '/events', provides: 'text/event-stream' do
protected!
response.headers['X-Accel-Buffering'] = 'no' # Disable buffering for nginx
response.headers['Access-Control-Allow-Origin'] = '*' # For Yaffle eventsource polyfill
response.headers['Cache-Control'] = 'no-cache' # For Yaffle eventsource polyfill

stream :keep_open do |out|
settings.connections << out

# For Yaffle eventsource polyfill
#Add 2k padding for IE
str = ":".ljust(2049) << "\n"
#add retry key
str << "retry: 2000\n"
out << str

out << latest_events
out.callback { settings.connections.delete(out) }
end
Expand Down
6 changes: 5 additions & 1 deletion templates/project/assets/javascripts/application.coffee
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# make sure Yaffle's eventsource goes in first
#= require eventsource.js


# dashing.js is located in the dashing framework
# It includes jquery & batman for you.
#= require dashing.js

#= require_directory .
#= require_tree ../../widgets

console.log("Yeah! The dashboard has started!")
# console.log("Yeah! The dashboard has started!")

Dashing.on 'ready', ->
Dashing.widget_margins ||= [5, 5]
Expand Down
Loading

0 comments on commit 3bca71e

Please sign in to comment.