I notice that Growl allows for the possibility of Growl notifications from a website. Has anyone tried implementing this?
If so, what form did it take? Did you implement multi user support? And, can you provide any code examples (C# or Objective-C would preferable but I'm not that fussed)?
Rich
There are GNTP (Growl Network Transport Protocol) bindings for various languages, a list of bindings can be found here - these allow you to send notifications from, say, a PHP script.
I wouldn't trust Growl's UDP system directly, but rather write a server that receives and stores notifications (maybe as a tiny web app), and a local script that routinely grabs any new messages via HTTP and Growls them. Not complicated at all, will be more reliable than UDP, and can queue up messages when your Growl'ing machine is powered-off or unreachable. Shouldn't take long to implement
Basically, server.php
in pseudo-PHP (which could use Net_Growl):
<?php
if($_GET['action'] == "store"){
$title = $_POST['title'];
$message = $_POST['message'];
$password = sha1($_POST['password']);
if($password == "..."){
store_in_database(sanitise($title), sanitise($message);
}
} else {
print(json_encode(get_notifications_from_database()));
mark_notifications_as_read();
}
?>
client.py
in pseudo-Python (which could use gntp):
while 1:
time.sleep(60):
data = urllib.urlopen("http://myserver.com/server.php?action=get&password=blah").read()
for line in data:
notif = json.decode(line)
growl.alert(notif['title'], notif['message'])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With