File: ticker.rb

package info (click to toggle)
ruby-faye 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 1,792 kB
  • sloc: javascript: 14,833; ruby: 5,068; makefile: 30
file content (14 lines) | stat: -rw-r--r-- 271 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
require 'rubygems'
require 'bundler/setup'
require 'faye'

EM.run {
  endpoint = ARGV.first || 'http://0.0.0.0:9292/bayeux'
  client   = Faye::Client.new(endpoint)
  n        = 0

  EM.add_periodic_timer 1 do
    n += 1
    client.publish('/chat/tick', 'n' => n)
  end
}