Silverlight example

Jul 21, 2010 at 5:41 AM
Is there be a Silverlight example available? Thanks.
Jul 21, 2010 at 4:48 PM

Silverlight client and sample will be available before te end of the weekend.

Jul 22, 2010 at 3:18 AM

Tomasz, Thanks.  I may be asking too much... Can you also include an WPF example? Thanks.

Jul 22, 2010 at 4:18 AM
Edited Jul 22, 2010 at 4:19 AM

I will have both Silverlight and .NET clients, but I am not sure if time will allow for a WPF sample though.

Jul 24, 2010 at 7:50 PM

Yes, you are right, I think .NET client is what I am looking for. WPF is a UI layer...


Another question:

I want to integrate an "authentication+profile+contact" features into this. The scenario is that user can register, login, add/find his contact, and then start their own topics.

I am thinking to use the Windows Live ID SDK to add authentication+profile+contact part (perhaps another option is the ASP.NET Auth/Role/Profile).

Does this library will add support for this kind of feature? In your "documentation" section, you mentioned about "Authorization", what do you mean by that?

Thank you very much.


Jul 24, 2010 at 8:06 PM

Security is fundamental for use of this technology in any practical application. Adding security support to Laharsub is next on my list of priorities after adding Silverlight and .NET clients. As such I am curious about your requirements and ideas on how this service should be secured. Below are my very initial and unbaked thoughts.

There are several aspects of security and I would prioritize them as follows from the perspective of prospective applications of Laharsub:

  1. Server authentication. This protects the client by ensuring it is talking to the correct server. Practically it implies using HTTPS with server side authentication.
  2. Authorization. The application needs to control who can invoke the CreateTopic, Publish, and Subscribe APIs. The granularity of this decision should be per-topic for the Publish and Subscribe APIs, and per API for the CreateTopic call. That means the server can allow user A to Publish to topic 1 and user B to publish to topic 2, as well as identify a set of users who can create new topics. In terms of techology to enable this, I was planning on investigating oAuth 2.0. Thoughts?
  3. Integrity and confidentiality of data. While in practice one gets it along with #1, in theory I think this is less of a requirement than #2 given the target scenarios of this technology.

I am curious about your thoughts.

Jul 26, 2010 at 4:01 AM

As promised, the new release of Laharsub is available at This release contains:

  1. .NET 4.0 client with unit tests at 65% code coverage
  2. Silverlight 4 client with unit tests
  3. jQuery client
  4. .NET 4.0 WCF HTTP pub/sub server based on an HTTP long polling protocol, hostable as a Windows Service or a console application.


Jul 26, 2010 at 5:07 PM

Thanks for the release.


Regarding security feature:

My senario is a pretty simple one, functionally similar to chat room application, user can join/create different chat rooms (topics) and exchange messages with other partipants (as both publisher+subscribers). But I intent to use resource-limited microcontroller device as client, working concurrrently with PC clients.

From your description, you intent to "abstract" out the security functionality in this framework, right? if so, that is great since people can plugin their own implementation.

1) Server-side authentication, this already fits my need, simple for client code and secure enough for me. But it will be great if the actual code inside laharsub is only an abstraction, and people can plugin their own implementation (liveID, openID, ASP.NET authentication, etc). But I am no expert on this. Does this mean that Laharsub maintain a database of "valid users", how and what validates these "valid users" is app-user's implementation?

2) Authorization abstraction: I am not familiar with oAuth 2.0, but this is interesting, perhaps oAuth is such an abstraction. From reading some simple description on web, it seems that oAuth is a way to provide 3rd party application "limited/controlled/timed" access to your own resource in another app without exposing your ID/password. Perhaps you can share more thoughts on how you intent to use it to control the granularity of api access in laharsub?

3) Integity and confidentiality of data: I think if needed, this can be done outside of this framework by the user-app, since the "meaning of message/data" is different for different app.




Nov 12, 2010 at 8:03 PM
Edited Nov 12, 2010 at 8:04 PM

I don't see a silverlight client in the download. Okay, more specifically, I don't see an actual silverlight application to prove that the client works.

Nov 12, 2010 at 8:22 PM

There is no Silverlight client sample in the main project, but you can check out a Silverlight web chat sample for Laharsub built by Cristian Daini at

The main project contains unit tests for the Silverlight client at src\client\silverlight\Laharsub.Client.TestWeb which you can run from the Laharsub.sln solution. It requires Silverlight Toolkit to be installed. The Laharsub.exe server must also be running. 

Nov 12, 2010 at 8:51 PM

Thanks, I managed to get it to work.

Jan 7, 2011 at 1:01 AM

It seems like there is a bug in Silverlight web chat sample.  Application is throws an "Invalid cross-thread access" exception on any incoming message. 

To fix that i've added Dispatcher.BeginInvoke() call in  AddLineChatBox - MainPage.xaml.cs  like that: 


        /// <summary>
        /// Add a message to the Chat box
        /// </summary>
        void AddLineChatBox(chat mode, string line, params object[] args)
            if (mode != chat.debug || showDebugLines)
                this.Dispatcher.BeginInvoke(() => {
                    line = string.Format(line, args);
                    Chat.Text += string.Format("({0}) [{1}] {2}\n", DateTime.Now.ToString("HH:mm:ss"), mode.ToString(), line);
                    Chat.Select(Chat.Text.Length - 1, 0);

Exception is gone and finally, incoming messages are displaying in the chat window.

If there is nothing wrong with this fix - i think it would be good to add it the project repository.  :)

Jan 9, 2011 at 11:49 AM

Hi Antares,
I think you are using an “old” Laharsub version.
See for more information about this issue.
Please make sure to use the last Laharsub version


Jan 10, 2011 at 1:41 AM

Thanks a lot, Cristian! 

You're right, i'm using last binary release  (Oct 9 2010). According to changeset - downloading the last version from repository should help. )

Ok. I think it would be reasonable to make a note somewhere on chat sample's site, that last "sourcecode version" of Laharsub contains this important fix.   Just to avoid the user's confusion. :)