Sha256: fe7308017988af93e434ea2dc7bfbc5ce7b955215c8e2510c41f1d7d8e38d677
Contents?: true
Size: 727 Bytes
Versions: 3
Compression:
Stored size: 727 Bytes
Contents
require 'pusher-client' module Dato module Watch class SiteChangeWatcher attr_reader :site_id PUSHER_API_KEY = '75e6ef0fe5d39f481626' def initialize(site_id) PusherClient.logger.level = Logger::WARN @site_id = site_id @socket = nil end def connect(&block) return if connected? @socket = PusherClient::Socket.new(PUSHER_API_KEY, secure: true) @socket.subscribe("site-#{site_id}") @socket.bind('site:change', &block) @socket.connect(true) self end def connected? @socket && @socket.connected end def disconnect! connected? && @socket.disconnect end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dato-0.3.2 | lib/dato/watch/site_change_watcher.rb |
dato-0.3.1 | lib/dato/watch/site_change_watcher.rb |
dato-0.3.0 | lib/dato/watch/site_change_watcher.rb |