ASP.NET SignalR – Beyond the Chat Application

Last January 30, I talked about ASP.NET SignalR 2.0 and what are the other uses of the technology aside from the chat application that’s widely available in the internet.

The first time I talked about SignalR (Q2 2013) is about the overview of the technology, and how it is used based on the chat application. From that point, I haven’t seen any implementation yet on how can it be used in business applications – a world where I actually work in. Although a quick check now on the project’s SignalR GitHub page, there are some projects/applications published using this technology.

Fortunately, an unfortunate incident that was reported before by a friend was a good business case where this technology can be implemented. The scenario is something like this:

Employee was working on an application where the users are located on multiple locations and multiple timezones. Employee worked with the business partner to schedule the production release of the approved enhancements. Business sent out prior notifications to the departments through e-mail and employee worked on the technical team that will assist in the release. Departments are responsible for cascading this information to their respective units as they are more aware of the specific roles for their group.

The release was made but had to be pulled out minutes after due to business reasons. The time in between the post release and the time it had to be reverted, data corruption happened and these needs to be corrected. It took a long time and large effort to reach out to different users to remediate data fixes.

A root cause analysis was conducted and one of the suggestions is that in the future releases, introduce the app_offline.htm file in the root folder of the application to make sure that no one is actually working on the application on the time of the release.

While the app_offline.htm file effectively excludes everyone from the application (aka “soft offline”), this might be costly for some who are currently working on the application. Either they had to re-upload a large file, re-input lots of data once an abrupt “activation” of the app_offline.htm file is put into place. It would be nice if these people would be notified of the upcoming outage ONLY if there’s a way to identify their current site activity and send them notices as warning to save their changes.

Building up a prototype using SignalR might be useful for these reasons:

  • Current users of the application are considered as “clients” connected to the server. Application administrators don’t need access to the web server just to get the number of users online (through perfmon) OR use an application level variable (and using that nasty Application.Lock() method) that can probably cause performance penalties.
  • I can treat the whole application as a glorified “chat session” and send broadcast messages to all or specific users (more on the sample application). I can send notifications individually or to everyone, as I desire through divs triggered according to events.

In my talk, I used two pages to demonstrate SignalR. It all started with converting a SignalR 1.x application to version SignalR 2.0.x and build the demo from that.

Client Page (signalr-Notification.aspx)

The client page provides three different ways of participating in the application session (or “chat”) – using the current windows identity, a client-input name, or a value taken from the web.config.

Image

Once you have selected your “identity”, you would see a familiar chat window similar to the chat demo. What made this demo different is that you have three functionality that builds on top of the chat demo.

The first two buttons in this page provide notification to all connected users, while the last one just provide notification to the user calling the function. The first button sends notification based on a fixed value. This could either be a standard greeting to those joining the session or any hardcoded value (e.g. name of the application, etc) that you wish to broadcast.

The second button broadcasts value from the web.config file. As indicated in the scenario above, it would have been better if the current users using the application prior the updates be notified that the application would go offline in x number of minutes. Case for example, if the website is scheduled to go offline in a specific time, you can get the value of the offline schedule (date or datetime) from the web.config and broadcast it to the users. This button is quite flexible on what data to broadcast or notify since you have control on what data to display to the connected users.

The third button simply displays how many users are connected to the application at that point. That’s just it. You would know how many people are actually having an active session with the application. Previously on ASP.NET Membership, the basis of number of users online is based on the users’ login session. However, if I say I login and close the browser after authentication, I would still be recognized as “online”.

Admin Page (signalr-Admin.aspx)

Getting through the admin page needs you to be identified again in the system. I just basically reused the first page and added admin-related items.

In the admin page, I displayed all connected users and their corresponding connection IDs. From this point, the “admin” can send individual messages to the user or broadcast to all a message. This is similar to a Facebook notification wherein people associated or a specific person gets notified for an update or message.

Admin

The demo files can be downloaded through my Skydrive folder and is provided as is.

There are other enhancements/items that I am working on this project:

  • Ability to return back to the admin who among the users have acknowledged the notification. An event can be raised and capture the current username of the user who clicked the notification.
  • Do a comparative speed/latency test on connections coming from different browsers. Note that SignalR’s mode of transport depends on the type of browser that a user uses to work with the application.

Questions? Feel free to ask them in the comments. 🙂

Advertisements

Second Time Around

This year’s Microsoft MVP Summit is my second (2011 was the first) and so far the best that I have experienced! It was without my knowledge that this year, if not for my friend that 2013 would be the 20th year that the program is in place and making it in this momentous event has caught me by surprise.

The range of topics for my specific area of expertise are exciting in the sense that I can’t wait to get dirty with my hands as well using those. Of course, what they’re are – are still covered by NDA hence, it can’t be released in public until Microsoft makes it public themselves. I could remember that during the last summit, what we are currently using were previewed then but with MVPs’ input and in various CTP releases, they have shipped a good product where everyone is pleased (not giving specifics but it is released in VS 2012). 🙂

Prior to the summit, selecting my sessions, I realized that most of ASP.NET/IIS related topics are assigned in Hyatt. In a way, I am disappointed by it as the previous summit that I have attended, sessions were held in the main campus in various buildings. Given that I have attended only 2, there were some differences with the range of activities held however, I am pretty much satisfied with how things worked this time – logistics, food, internet (a must!) and activities.

This slideshow requires JavaScript.

But more than the sessions, I really liked as well the activities on socialization where I got to meet not only Microsoft People that I look up to but also different MVPs from other countries such as Germany, Switzerland, Japan, and UK. Likewise, I was able to meet Filipino MVPs who are based on other countries as well. Aside from pleasantries, the exchange of communication was the highlight of the event. That is where we put faces behind the names and talk about common interests and share techniques and approaches that would help fill up best-practices in our respective organizations. The camaraderie has shown that the MVPs are not just techie guys but fun guys as well fueled with passion to use and share about the Microsoft technologies. This passion drives the most of us to PASS It ON to others to make lives, experiences, and computing better!

Happy 20th Microsoft MVP!

Use Your Globe Tattoo with Sun (or other providers)

Edit: I DON’T UNLOCK MODEMS. PLEASE READ BEFORE YOU POST

Pagbabago: HINDI AKO NAG-UUNLOCK NG MODEM. PAKIBASA BAGO MAG-COMMENT.

My unlocked Globe Tattoo USB Modem with the SIM Cards that I am using for wireless connectivity in order of preference. It’s Sun Wireless Broadband in Metro Manila, Smart for other places. If all else fails, Globe MIGHT work, but not guaranteed.

I am tired of Globe Tattoo. I am, and I have given up. I was initially happy having an own prepaid wireless connection saving me from the waiting for the internet connection in the house that I won’t be able to use. Unfortunately, that excitement easily went away when Globe is only reporting to me with GPRS connection and I can only browse sites at speeds slower than dial-up speeds.

A friend of mine has been recommending Sun Broadband then but I am a bit skeptical with Sun knowing he has worked there (am I right? He he he) so it might be another marketing ploy that I get easily fooled with. On the verge of selling my Globe Broadband Tattoo kit at a cheaper (lugi) price, I researched if it’s possible to unlock my Globe Tattoo modem and use another provider with it. There were some blog sites but they are full of motherhood statements saying it is possible but didn’t say how. After going through links and pages, I finally found the page that allowed me to use my Globe Tattoo device with another provider. Here are the steps (based from the Globe Tattoo software):

1) Know your device make and IMEI. The device information is found at the back of the modem or in your software, go to Tools->Diagnostics. You will see the device IMEI there.

2) Go to this site. Provide your IMEI and Huawei device model. If your device is not Huawei, stop here and browse the forums or somewhere else that can unlock your modem. Wait for minutes, hours (at most) for a reply for the unlock code for your device. People there are generous so just be patient.

3) This could be step 0 but I’ll place it here. Go to a Sun Shop, buy a Sun Wireless Broadband SIM card for only 50 pesos. This is pre-loaded with 5 hours internet. Since it would be bitin, buy also a 100 Wireless Broadband Prepaid card. Specify that you’re looking for the Wireless Broadband Prepaid card.

4) Insert the Sun sim card (or Smart) in the device. The device will prompt you for an unlock code. Provide the code in #2. You have 10 tries before busting the device. Luckily, I got mine at the first try.

5) Once unlocked, it is unlocked! You can now use any wireless provider aside from the despicable Globe Tattoo connection.

Of course, the signal is there but you need the settings right?

 

Sun Wireless Broadband

APN: minternet

Dial Number *99#

Smart Buddy

APN: internet

Dial Number *99#

With this information, I am taking the risk that many people would follow this route and at the same time flood the network of Sun. Who cares, I am happy with the service and I guess others should experience the same too. When I was in CDO, Globe is slower than Smart. Sad, I was only able to buy a Smart SIM card on my last day in CDO. I spent Php180 on Globe for a connection that hangs and I am automatically charged 5 pesos for that.

Goodbye Globe, Hello Sun and Smart!

Silverlight 3.0 Released!

I am a bit excited with the release of Silverlight 3.0 and while searching the pages of Silverlight, a download link has been made available for the public to get the Released To Web (RTW) version. Likewise, developers can also take advantage of the Silverlight 3.0 SDK though you need to remove any beta pre-RTW Silverlight 3.0 SDK. Aside from that, Silverlight 3.0 Tools for Visual Studio 2008 is also available for download.

sl30

Here are some useful links that you can check out (links open in a new window):

Key improvements for the release are grouped into 4 categories:

  • Media: GPU hardware acceleration, new codec support (H.264, AAC, MPEG-4), raw bitstream Audio/Video API, and improved logging for media analytics
  • Graphics: GPU Acceleration and hardware compositing, perspective 3D, bitmap and pixel API, pixel shader effects, and Deep Zoom improvements
  • Application development: Deep linking, navigation and SEO, improved text quality, multi-touch support, 60+ controls available, and library caching support
  • Data: Data-binding improvements, validation error templates, server data push improvements, binary XML networking support, and multi-tier REST data support

Still, I am waiting for the launch of the site See The Light (www.seethelight.com). It is already 10 July 2009 here in Manila but perhaps the launch of the site would be the time in the US. 🙂

Friendster Bug?

fslogo

I am currently studying some of the existing social networking sites for one project that I have been doing. In my laptop, my profile cookie in Friendster is saved since I am the only person using that laptop. That alone would save me from entering my credentials over and over again when I visit that page.

A certain concept in the design of social networking sites is common across sites and that is having a “limited” profile view. That is, you won’t be able to see the whole profile of the person you are viewing unless you are a contact or a friend of that person. Facebook’s implementation is too conservative while LinkedIn’s is customizable. Beyond Multiply (which I am more familiar with), Friendster is one of those popular social networking sites here in the Philippines, and I reviewed it. I barely check on other’s profile that’s why I don’t have a complete picture of how can you view a restricted profile in Friendster. I opened my IE wherein I am not logged-in in Friendster. I was able to see the “restricted” view of my friend’s profile BUT I noticed that the “Login” link was changed to “Log Out”. When I clicked on the “Profile” tab, my page was loaded.

I logged-out from Friendster in IE (even if I didn’t log-in), had a hard refresh (ctrl+f5) around 5 times. Closed the browser and repeated the same steps again and I found out that I was even logged in after all those things. Could this be another case of a faulty security implementation? As far as I know, two different browsers cannot share the same cookie of the same domain. From what I suspect, Friendster could have been storing sessions of users in their database that includes the username/email of the person, IP address, and the time they were last seen online. If a request has been made from another browser (say in my case in IE, where I am not logged-in) when a user tries to view a user but isn’t logged-in, the request would check from the database if an active session is in place from the same IP address and if a record is found, the request would make an authentication cookie in the browser even if he/she hasn’t logged-in in the system. I think this scenario is a security concern – case for example would be in a typical internet cafe set-up where only one public IP is being published, it is possible that even if you’re not logged-in in your account, you would be able to gain some “control” over the other accounts. While other features would prevent you from changing the password but the mere fact that you are able to log-in to an account isn’t yours or didn’t intentionally log-in, once the intruder makes some changes to your profile, it could mean a lot of things especially those that can see the spoiled information.

I am not sure if you can replicate the error, I think it is not just happening to me. Try it and let’s talk it over.

Can’t Install Windows Live Wave 3?

livex

I had the chance of getting the full offline installer of Windows Live products last night and I planned to upgrade all my installations of Windows Live products at home and at the office. It took me a sweet upgrade for the desktop and laptop at home unfortunately when I tried upgrading the products in my workstation, it gave me an installation error of 80004004 for Windows Live Messenger and some errors again on the other products.

livex

I am only particular with Windows Live Messenger and it’s a pain not to use that program on a daily basis. Seems like the error number that I have been encountering is not particular to Windows Live Messenger installation and it’s been associated with ActiveSync errors as well.

Upon further analysis, seems like the installation registries of previous Windows Live Products have been hindering the completion of the installation of the Wave 3 products. As a fix I removed all installation registry information for all previously installed Windows Live Products (well, I have no choice). If you can’t remove it via Add/Remove programs (or ctrl+r then type appwiz.cpl), you may use the Windows Installer Clean-Up Utility to force uninstallation of the products you have to remove.

After that, I was able to install the Windows Live Wave 3 products smoothly. Such a tedious task for a simple upgrade process.

I Support PinoyWebStartUp

Pinoy Web Startup - tech startup profiles in the Philippines

Because I am starting one myself focusing on making custom web application development with ASP.NET 2.0/3.5 and PHP. I develop, I don’t design. Luckily, I have a friend who designs for free (basta para kay Yummy este sa charity).

I hope to launch it before the year ends, if not, early next year.