Sha256: 2118f0a549acca7be44e802ebbaae690a6acc1ad82eb56c802988c9aca2bb091
Contents?: true
Size: 835 Bytes
Versions: 3
Compression:
Stored size: 835 Bytes
Contents
# Racoon - A distributed APNs provider # Copyright (c) 2011, Jeremy Tregunna, All Rights Reserved. # # This module contains the worker which processes notifications before sending them off # down to the firehose. require 'ffi-rzmq' require 'zmqmachine' module Racoon class Worker def initialize(reactor, address) @reactor = reactor @address = address @send_queue = [] end def on_attach(socket) @socket = socket socket.connect(@address.to_s) end def on_writable(socket) unless @send_queue.empty? message = @send_queue.shift socket.send_message_string(message) else @reactor.deregister_writable(socket) end end def send_message(message) @send_queue.push(message) @reactor.register_writable(@socket) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
racoon-1.0.1 | lib/racoon/worker.rb |
racoon-1.0.0 | lib/racoon/worker.rb |
racoon-0.6.0 | lib/racoon/worker.rb |