class Async::Container::Notify::Server::Context

Public Class Methods

new(path) click to toggle source
# File lib/async/container/notify/server.rb, line 79
def initialize(path)
        @path = path
        @endpoint = IO::Endpoint.unix(@path, ::Socket::SOCK_DGRAM)
        
        Sync do
                @bound = @endpoint.bind
        end
        
        @state = {}
end

Public Instance Methods

close() click to toggle source
# File lib/async/container/notify/server.rb, line 90
def close
        Sync do
                @bound.close
        end
        
        File.unlink(@path)
end
receive() { |message| ... } click to toggle source
# File lib/async/container/notify/server.rb, line 98
def receive
        while true
                data, _address, _flags, *_controls = @bound.recvmsg(MAXIMUM_MESSAGE_SIZE)
                
                message = Server.load(data)
                
                yield message
        end
end