Building a SharePoint Online chat room with SignalR and Azure

I’m a huge believer in the concept where if the only tool in your toolbox is a hammer, then everything becomes a nail.  As it turns out, trying to install a new tile floor or unclog a drain with just a hammer becomes problematic.  So, in an effort to add more tools to my software development toolbox, I’ve recently spent some time tinkering with SignalR.  SignalR is an ASP.NET library that allows your web server to actually push content out to the individual client browsers, as opposed to having the site request data from the server each time an update is needed.

RSS feeds via SignalR

My first foray into SignalR involved subscribing to a few RSS feeds and then pushing the updates from those feeds to a website.  Basically, when you navigated to the site, the server would enter a continuous loop that polled each RSS feed for updates every 10 seconds.  If the RSS feed had updates since the previous check it would then push those updates out to the site via SignalR, where it was then rendered on the page.  Unfortunately, RSS feeds are only updated every few minutes, at best, so it took quite a while to truly test end-to-end.  Anyway, it was a fun experiment and the results looked like this:


Not particularly pretty but I didn’t care about the look of the page.  I just wanted to understand how SignalR worked and this accomplished that task.

What else?

After the RSS feed experiment, I wondered what else I could do with SignalR.  The quintessential SignalR demo seems to be the chat room.  However, most of the chat room demos that I found involve going to some generic web page, entering in whatever user name you like, and then it allows you to send messages back and forth with other users.  These demos generally get the point across in terms of how SignalR works, but probably wouldn’t be something that would be useful in an enterprise environment.  I thought that if I were going to also create a chat room demo, then it needed to be something that could potentially be useful for an enterprise.  A while back, I read a blog post by Zach Holman discussing the the idea of working asynchronously and how that had worked well during GitHub’s startup phase.  On my team at Microsoft, we also have a SharePoint site that we use to store various documents and such.  That’s when I thought:  What we need here is a chat room that can be plugged into SharePoint so that everyone on a team could interact and collaborate from one single place.  That’s what I set out to do.

We’re going to build what?

The plan is to build a SharePoint app, built in ASP.NET MVC, powered by SignalR, that runs inside of Office 365/SharePoint Online, and is hosted in Azure.  Sounds like fun, right?

This turned out to be a pretty lengthy walkthrough, so I’ve broken it down into 6 parts:

Part 1: Create the SharePoint Online app and associated website

Part 2: Test the app in Visual Studio

Part 3: Create the SharePoint Online web part

Part 4: Deploy the site to Azure

Part 5: Deploy the app in SharePoint Online

Part 6: Gotchas and Thoughts

Leave a Reply

Your email address will not be published.