×

First time here?

You are looking at the most recent posts. You may also want to check out older archives. Please leave a comment, ask a question and consider subscribing to the latest posts via RSS or email. Thank you for visiting!

I was messing around with a new internal application the other day and made a wise crack about some of the features out in the open.  And by wise-crack, I mean ‘feedback in the nicest way possible’ of course.  On one of my suggestions someone pointed out a RTFM moment that the feature was actually in there but had a dependency.  The feature I was requesting was “toast” notifications.

What is “toast”?  Aside from a delicious breakfast treat, it’s a term that most people refer to those little notification windows that popup from applications in the Windows system tray.  Sometimes annoying, mostly useful (depending on how many notifications you get of course). 

examples of “toast” notifications

If you are a Windows programmer, there are APIs you can directly tap into to trigger these things in the standard notification bubbles provided by Windows.  If you are a web programmer though, it would be a challenge to bubble up a message to the native client from a web page with ease.  You could if you wanted though, as Windows provides a standard method for any application to opt-in to using.

OSX users have the same feature (global notification system), but I’m assuming it isn’t easy to use, which is why Growl exists.  It is an application itself that allows a developer to send a notification message to it.  It is user configurable (meaning I, the user, define what my notifications look like and when), but serves as a platform for OSX app developers to leverage and provide the user with a consistent notification platform.  Growl is not a part of OSX though and still requires to be there.

Back to my internal app feedback.  This application made use of something I wasn’t aware of – Growl for Windows.  It’s basically a Windows port of the Growl framework.  Interesting I thought.  I wondered why this application developer of our internal app didn’t just use the native Windows notification system, but I digress.  I started looking around and saw that they have it enabled for web applications to use it.  Cool!  Of course the dependency is still required (i.e., it must be installed), but if it is there, you can use it!  Now, there are others that emulate this type of thing like jQuery Growl for web applications.  These frameworks, however, show notifications in your application and not in your operating system.  So if your web app was minimized you wouldn’t see the notification.

I got curious and saw they had a Javascript library to use…hmmm…Silverlight notifications.  So I busted out a quick sample application for Silverlight that provides notifications through the Growl framework.  Here’s a quick video of my efforts with me explaining a bit:

So what you have is multiple parts.  First, it will only work if Growl for Windows is installed, so if you want to play around, install it.  Second there is the Growl.js library of the framework.  This would be in your web application hosting your Silverlight app.  That’s really all you need.  Now you can expose some Javascript functions to call the library.  I created a generic one called NotifyGrowl which takes a title and content.  This is very generic and uses a single notification type.  Growl let’s you configure notification types to segment your messages a bit and allow your user to customize them like a different UI for error types versus warning types.

It’s pretty cool and interesting to play around with.  Now for the things I don’t like…

Flash – It feels just a little dumb to be using a Flash component in a Silverlight application.  In fact that’s what is happening here.  The JavaScript API for the framework, really is a JavaScript API to a Flash application.  When you initialize the Growl API in JavaScript, you are creating a SWF dynamically that you are then communicating to in later calls.  It works, and works well, but it just feels wonky.

HTML Bridging – Hence the name of JavaScript implies that you’re using some HTML bridge activity to call from Silverlight into the API.  While this is incredibly easy (you can learn how to do this here: <>), it will only work in-browser at the moment.  I think the real power of notifications could be in the out-of-browser applications.  Unfortunately, the HTML bridge isn’t available in OOB right now.

Dependency – This is obvious.  While it is cool, it relies on Growl for Windows being installed.  Are you going to ask your users to install two things?

Not common Growl – The API I played around with wouldn’t trigger Growl on OSX.  That kinda sucks.  I thought it would which is why I started messing around.  I figured you’d be able to write to an API that both platforms subscribe to, but it isn’t the case.

The Growl for Windows project does have a .NET library, so why would I use the JavaScript/Flash one?  Well, the Growl system relies on socket communication so in theory, Silverlight should be able to use it.  Right now, however, Silverlight has restricted port ranges for socket communication.  Those port ranges don’t fall in line with the current accepted range for Growl messages.  In theory (and I’ve asked the developer about this) you should be able to forward messages back/forth.  An experiment for another time perhaps.  Right now the developers of Growl for Windows operate using the Growl Notification Transport Protocol (GNTP) but the Mac/OSX version of Growl does not yet.  Apparently the Mac/OSX developers have pledged to work on this. 

It was a fun experiment to play around with and see how a Silverlight/browser application could provide OS-wide notifications if a framework existed.

What do you think…would you like a “toast” navigation API in the Silverlight runtime for you to use?  What features would you expect that feature to have?


This work is licensed under a Creative Commons Attribution By license.


8/10/2009 4:18 PM | # re: Silverlight 3 “toast” notifications
fyi

The work has been done on Mac, but is currently only available in developer builds of Growl. You can find more info on it here:

www.mikechambers.com/.../growl-support-for-adob...

and on the growl developer list (search for GNTP).

mike chambers

mesh@adobe.com
8/10/2009 4:21 PM | # re: Silverlight 3 “toast” notifications
Mike -- Brian did tell me this as well. I hope that it makes it out of dev builds soon otherwise it's still fiction for end users right ;-)
8/10/2009 4:23 PM | # re: Silverlight 3 “toast” notifications
a toast/notification API in Silverlight would be great. but the benefit would be greatly increased if it tied into a larger system. the power of Growl on the Mac is that all notifications go through one central place, so the user has complete control over what gets shown and how it gets shown. if Silverlight creates its own API that only works with Silverlight apps, that would be less useful than something that any app can integrate with and only adds to the different places that users must go to configure things.

if the desire is to remove the extra dependency, then perhaps Silverlight or even the OS could offer a default 'handler' of sorts for displaying the notifications. but it would be nice to be able to override that behavior with a full-featured app like Growl that allows setting per-notification preferences, forwarding to a multitude of devices, custom displays, history, etc. just my 2 cents. =)
8/10/2009 4:31 PM | # re: Silverlight 3 “toast” notifications
I've been thinking about this issue as I was looking to develop (yet another) TweetDeck Twitter app in silverlight and Toast is one thing that Silverlight can't do. It does bother me that Air apps don't use the system's UI notification. As an end user I'd be rather annoyed if I had to install something extra (other than Silverlight) to get toast to work (Mac or PC). How bad is the Mac notification system, unusable?
8/10/2009 4:36 PM | # re: Silverlight 3 “toast” notifications
Andrew I don't know how bad the OSX notification system is, but almost every app I have on OSX uses Growl instead. That tells me that whatever OSX provides, Growl is easier.
8/10/2009 6:15 PM | # re: Silverlight 3 “toast” notifications
Interesting approach (integrating the notifications into a central system on the client/target OS). We built one of these for our current SL3 product that just shows _within_ the browser window, and it was extremely simple to setup the keyframe animations to fade in/show/fade out the toaster visual based on push notifications received from the server. Integrating these into the OS is worth some more thought....my knee jerk reaction is that requiring another install to support your SL application is bad. Thoughts?
8/10/2009 6:24 PM | # re: Silverlight 3 “toast” notifications
I would rather have general (and secure) way to communicate to local applications instead of specialized API for every single task.
Asking user to install growl is fine, since it provides incremental functionality and not a core feature. Html bridging is a much bigger issue for me. Some of most serious security issues I've encountered was related to JavaScript-Flash bridge.
8/10/2009 8:30 PM | # re: Silverlight 3 “toast” notifications
Mike -- I have the same knee jerk reaction. I think the best approach now would be if you liked/wanted this OS-wide notification system, that you could do a if(GrowlIsInstalled) mechanism to check and see if there is a notification system available for you. Growl provides this check in their API.
8/10/2009 8:45 PM | # re: Silverlight 3 “toast” notifications
Tim, nice work - I'd love to see something like this be supported cross-platform. I don't think it's too much to ask someone to install Growl.. for that matter, for internal apps, it would be trivial for us to do this on the workstations - especially if we can run it on Win/Mac/Linux and just have one implementation between the 3 (assuming Moonlight will extend it to Linux of course).
8/10/2009 10:02 PM | # re: Silverlight 3 “toast” notifications
I'm not 100% sure I like the idea of a browser app sending desktop notifications. It feels as though the application has somehow broken through the browser sandbox. I think the user may be a bit confronted when an untrusted web application starts to behave - in their minds - as an installed (and trusted) application. Personally, I would

On the other hand, I think it is perfectly acceptable for OOB applications to send desktop notifications (even though they are still sandboxed).
8/10/2009 11:32 PM | # re: Silverlight 3 “toast” notifications
For OOB being really OOB it should support toasts, being able to run in background but notifying when it's necessary. For in-browser apps, it should be a user-option to enable it.
8/11/2009 8:00 AM | # re: Silverlight 3 “toast” notifications
100% agree with Mike van der Eerden.

As to what features we'd expect?.....The Growl like features would be a good start.
Gravatar
8/11/2009 8:03 AM | # re: Silverlight 3 “toast” notifications
In a similar UI vein I'd like a way to have a smaller version of my SL app, much like WMP's mini version with controls to play/pause/ff. This should be visible even when the browser/OOB app is minimized. Edge case, I know ;)
8/11/2009 8:03 AM | # re: Silverlight 3 “toast” notifications
Mike/Yaip - how do you envision the opt-in feature for in-browser apps? Through the Silverlight configuration screen? or a prompt like when isolated storage increases?
8/11/2009 8:12 AM | # re: Silverlight 3 “toast” notifications
I have a question that's a bit off topic. I didn't realize that the HTML bridge wasn't available OOB. I'm assuming that also means I wouldn't be able to use any Axtive-x/Fire Fox plugins OOB either? Now that I type the question, it seems kind of obviouse that it wouldn't, but can you confirm?
8/11/2009 8:12 AM | # re: Silverlight 3 “toast” notifications
A “toast” navigation API in the Silverlight runtime would be awesome.
I'd expect it to be similar to the window that pops out when you install out of browser. Be able to position it in any corner of the screen (maybe depending on the platform) - Top, Left, Bottom, Right with Center, Left, Right.
Well...the ability to template these..maybe they should be ChildWindows at their heart. The user should be able to set the time to show this notification (in a fixed range say: 5-10 seconds) then stack these somehow in that "toast" or maybe the choice to make them disappear forever once they were shown. And I think there are many things that can be done around this cool feature.

Would I like a “toast” navigation API in the Silverlight runtime for me to use?
HELL YEAH TIM! :)
Bring it on!
8/11/2009 8:32 AM | # re: Silverlight 3 “toast” notifications
Herbrandson -- you wouldn't be able to use any ActiveX/FF plugins in-browser *in* a Silverlight application either :-). But to confirm, no you can't in OOB either :-)
8/11/2009 8:36 AM | # re: Silverlight 3 “toast” notifications
That's good to know Tim. I was thinking I could call from SL to Javascript that could in turn call an ActiveX component. Are you saying that's not possible in SL?
8/11/2009 8:41 AM | # re: Silverlight 3 “toast” notifications
Herbrandson - No, you can do that via the HTML bridge (i.e., have your SL app call a JavaScript function which calls another ActiveX control). In fact, that is what is happening here with the GFW example (Flash being the other ActiveX control. In OOB, however, 1) HTML bridge is not available right now and 2) the OOB app represents *only* the Silverlight app, not the entire HTML page it was hosted on. Make sense?
8/11/2009 8:55 AM | # re: Silverlight 3 “toast” notifications
regarding opt-in for web apps - in the Growl for Windows app that Tim demoed in his screencast, local apps are allowed to send notifications by default, but web/browser apps require the user to explicitly allow them. that way you dont just start getting notifications from out of the blue just by browsing to a page (which i agree could be confusing/undesirable).
8/11/2009 9:48 AM | # re: Silverlight 3 “toast” notifications
That makes perfect sense. Thanks for the clarification :)
8/11/2009 12:43 PM | # re: Silverlight 3 “toast” notifications
The opt-in would per default be off, but should be enabled by user-input. Like the way you can't put an app to full-screen without user interaction, but you as a developer still have the option to enable it. But users should always have an option to completely disable it altogether.
8/16/2009 2:43 PM | # re: Silverlight 3 “toast” notifications
We already have a toast API in SandShell for Silverlight, which creates notifications just like in Outlook. Of course, it does it within the browser...
8/17/2009 9:59 AM | # re: Silverlight 3 “toast” notifications
Any chance to have the source code for your sample ?
8/17/2009 10:00 AM | # re: Silverlight 3 “toast” notifications
Stephanie you can download the sample apps from the Growl for Windows project sites...same general code concept using the Javascript example.
8/17/2009 10:10 AM | # re: Silverlight 3 “toast” notifications
Thanks for your response Tim !
But the SDK purpose is for the windows implementation or Flash's one, not the Silverlight part.

Could you just help me with the correct "grow.js" and called you've made in Silverlight page ?

Thanks in advance !
8/17/2009 10:21 AM | # re: Silverlight 3 “toast” notifications
look at the HTML source of my hosting page here http://timheuer.com/silverlight/growl/ and you'll see the Growl Javascript I used. Then from Silverlight I just use HtmlPage.Window.Invoke() commands to call those Javascript functions.
8/17/2009 3:13 PM | # re: Silverlight 3 “toast” notifications
Thanks again Tim, but I experience the same problem with your website than mine :

swf is undefined
anonymous(Object name=Silverlight Growl, [Object name=Silverlight Growl Notificatoin 0=Object])growl.js (ligne 65)
RegisterAppForGrowl()growl (ligne 84)
onSilverlightLoaded(UserContro, Object name=args)growl (ligne 107)
[Break on this error] swf.register(application, notificationTypes);\r\n

PS : Tried with the Windows form sample and it works perfectly... Also activated the website option needed in the Growl application
8/17/2009 3:30 PM | # re: Silverlight 3 “toast” notifications
are you using Firefox? I noticed that too for some reason and haven't had the time to investigate why it isn't being registered correctly. I think it is in my code for loading the initial registration (which is where the swf object gets the reference).
8/17/2009 4:53 PM | # re: Silverlight 3 “toast” notifications
Yes I'm using Firefox, but the problem is the same with IE.
So it doesn't matter. I've just would like to try this notification's approach in an Silverlght app.
But there's no way to implement this in OOB environment (at this moment). So, that respond to your main question : YES, of course it would be great to have an implementation of this kind of "toast" notification in the Silverlight runtime !
It must be fully customizable and ready for the "in browser" and "OOB" environments both.

So : when you want ! ^^

 
Please add 1 and 4 and type the answer here:

DISCLAIMER:

The opinions/content expressed on this blog are provided "ASIS" with no warranties and are my own personal opinions/content (unless otherwise noted) and do not represent my employer's view in any way.