Skip to content

moteus/lua-gntp

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

lua-gntp

Build Status Coverage Status License

Implementation of Growl Notify Transport Protocol (GNTP) for Lua

Make common GNTP objects

local icon = GNTP.Resource.load_from_file('coulson.jpg')

local app = GNTP.Application.new{'LLUV_GNTP', icon = icon,
  notifications = {
    { 'CONNECT',
      title   = 'ConnectTitle',
      display = 'ConnectDisplay',
      enabled = true,
      icon    = icon
    };
    { 'DISCONNECT',
      title   = 'DisconnectTitle',
      display = 'DisconnectDisplay',
      enabled = true,
      icon    = icon
    };
  }
}

Using lluv async connector

local growl = GNTP.Connector.lluv(app, {
  host    = '127.0.0.1';
  port    = '23053';
  pass    = '123456';
  encrypt = 'AES';
  hash    = 'SHA256';
})

growl:register(function(self, err, msg)
  print(err or msg:encode())
  growl:notify('CONNECT', 'User connected',
    function(self, err, msg)
      print(err or msg:encode())
    end
  )
end)

Using LuaSocket sync connector

local growl = GNTP.Connector.luasocket(app, {
  host    = '127.0.0.1';
  port    = '23053';
  pass    = '123456';
  encrypt = 'AES';
  hash    = 'SHA256';
})

local msg, err = growl:register()
print(err or msg:encode())

local msg1, msg2 = growl:notify('CONNECT', {'User connected', callback = true})
if not msg1 then print(msg2)
else
  print(msg1:encode())
  print(msg2 and msg2:encode())
end

About

Implementation of Growl Notify Transport Protocol (GNTP) for Lua

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published