Sha256: 653161677fb1e823a47dfaf5ba0011bdc1001ec5f922f3c1a776d0eb6aab97f7
Contents?: true
Size: 347 Bytes
Versions: 11
Compression:
Stored size: 347 Bytes
Contents
require 'json' module Bait class << self @@Subscribers = [] def add_subscriber stream @@Subscribers << stream end def remove_subscriber stream @@Subscribers.delete stream end def broadcast *args @@Subscribers.each do |out| out << "data: #{args.to_json}\n\n" end end end end
Version data entries
11 entries across 11 versions & 1 rubygems