I finally got back to looking at a Growl interface for Windows today; there was an existing Mac interface in the public store already. What I did was create a factory class called GrowlInterface; it will hand back the Mac interface on OS X, and the network interface otherwise. You can always just use GrowlNetworkInterface directly.
I had some connectivity issues where the socket calls were just hanging, and this was confusing - I was looking at Carlos Crosetti's Squeak code, and I was sending the same format he was. After a brief chat with one of our engineers and some digging, it hit me: the GNTP protocol uses CRLF as a separator within message transmissions. So.... I had a line end convention issue. To fix that up, I merely changed my low level interface to this:
sendMessage: message to: sysName
"send the message to Growl"
| socket stream |
socket := (SocketAccessor newTCPclientToHost: sysName port: self port).
stream := socket asExternalConnection readAppendStream.
stream lineEndTransparent.
stream nextPutAll: message.
stream flush.
socket shutdown: 1.
stream close.
The thing I had to add was #lineEndTransparent. Once I did that, it all worked fine. I tried it out in both VW 7.7 and ObjectStudio 8.2 - so if you have an application that you would like to have communicate with Growl, have at it!
Technorati Tags:
growl, sockets, gntp