realtime applications for sharepoint with signalr and knockout.js

58
Realtime applications for SharePoint with SignalR and knockout.js Communardo Software GmbH Christian Heindel Bild durch Klicken auf Symbol hinzufügen SignalR @c_heindel

Upload: christian-heindel

Post on 09-May-2015

4.105 views

Category:

Technology


0 download

DESCRIPTION

As seen at http://www.shareconf.de/

TRANSCRIPT

Page 1: Realtime applications for SharePoint with SignalR and knockout.js

Realtime applications for SharePoint with

SignalR and knockout.js

Communardo Software GmbHChristian Heindel

Bild durch Klicken auf Symbol hinzufügen

SignalR

@c_heindel

Page 2: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

2

Agenda

Realtime applications• Goals, use cases,

examples

Push technologies• WebSockets, Comet

SignalR• Connections and hubs• Client libraries,

supported platforms, scalability

MVVM in JavaScript• knockout.js, jQuery,

JSON, oDATA

Events in SharePoint• Overview

Bringing it all together• SharePoint 2010• SharePoint 2013• SharePoint Online

Page 3: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

3

Agenda

Realtime applications• Goals, use cases,

examples

Push technologies• WebSockets, Comet

SignalR• Connections and hubs• Client libraries,

supported platforms, scalability

MVVM in JavaScript• knockout.js, jQuery,

JSON, oDATA

Events in SharePoint• Overview

Bringing it all together• SharePoint 2010• SharePoint 2013• SharePoint Online

Page 4: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

Goals

Improve user experience

Reduce server load

Page 5: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

Use cases

In general

• Adjust prices in real-time, e.g. for flight tickets

• Show new comments as they come in

• Activity streams

In SharePoint

• Show changes to list items

• "Who is online?"• Chat / Shoutbox• Download counter• Task status dashboard• …

Page 6: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

TFS – Team Room

Quelle: http://tfs.visualstudio.com/en-us/news/2013-jun-3

Page 7: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

Shopping cart

Quelle: http://tech.pro/tutorial/1146/building-a-shopping-cart-with-signalr-aspnet-web-api-and-knockoutjs

Page 8: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

Example: Stock Ticker

Page 9: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

Download counter

Quelle: http://melcher.it/2012/05/signalr-and-sharepoint-live-download-tracking/

Page 10: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

Upload visualizer

Quelle: http://blog-aspc.azurewebsites.net/sharepoint-with-signalr/

Page 12: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

JabbR

Collaborative chat done right

• Project:http://about.jabbr.net/

• Code:https://github.com/JabbR/JabbR

• Live demo:https://jabbR.net

Page 13: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

Example: ShootR

• Multiplayer space ship game built on the SignalR framework.

• Code:https://github.com/ntaylormullen/shootr

• Live demo:http://shootr.signalr.net/

Page 14: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

Example: Tic-Tac-Toe

• Code:https://github.com/fekberg/Tic-Tac-Toe

• Live demo:http://signalr-tictactoe.azurewebsites.net/

Page 15: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

15

http://www.christian-heindel.de/SignalRServer/

Page 16: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

16

Agenda

Realtime applications• Goals, use cases,

examples

Push technologies• WebSockets, Comet

SignalR• Connections and hubs• Client libraries,

supported platforms, scalability

MVVM in JavaScript• knockout.js, jQuery,

JSON, oDATA

Events in SharePoint• Overview

Bringing it all together• SharePoint 2010• SharePoint 2013• SharePoint Online

Page 17: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

Refresh a page after it has loaded

How you could try it…

• Client pull

• F5, Ctrl+F5, press the “Delete cache” button hard and often, then F5

• Polling: AJAX Request every 60 seconds? Every 5 seconds?

How you should do it…

• Server push

• WebSocket connection

• Comet techniques as fallback

Page 18: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

Comet (a.k.a. Ajax Push, Reverse Ajax, HTTP Streaming, HTTP server push)

• No page-by-page request or polling, but a long-held HTTP request

• Biggest problem: HTTP 1.1 (max. 2 simultaneous connections)

• Streaming:• Hidden iFrame• XMLHttpRequest• Ajax with long polling• XMLHttpRequest with long polling• Script tag long polling

Page 19: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

WebSockets

• Full-duplex communication channel over a single TCP connection

• Persistent connection• Cross origin support built in (CORS)• IETF RFC 6455• Port 80• WebSockets API (W3C Recommendation)• Web browser + web server need to implement it

• IIS 8.0, Apache 2.x, nginx 1.3.13+, lighttpd, node.js, …• Google Chrome 14+, Internet Explorer 10+, Firefox 6+, Safari 6+ and

Opera 12.10+

Page 20: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

caniuse.com

Page 21: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

21

Agenda

Realtime applications• Goals, use cases,

examples

Push technologies• WebSockets, Comet

SignalR• Connections and hubs• Client libraries,

supported platforms, scalability

MVVM in JavaScript• knockout.js, jQuery,

JSON, oDATA

Events in SharePoint• Overview

Bringing it all together• SharePoint 2010• SharePoint 2013• SharePoint Online

Page 22: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

ASP.NET SignalR

• SignalR started in July 2011 as a project by• David Fowler (Senior Software Design Engineer, ASP.NET Team) • Damien Edwards (Senior Program Manager, Microsoft)

• Now official part of the ASP.NET Technologies: http://asp.net/signalr

• MSDN documentation (since 03/2013):http://msdn.microsoft.com/en-us/library/jj891071(v=vs.111).aspx

• Source code on GitHub• Available via NuGet Gallery (22.000+ downloads in last 6 weeks)

Page 23: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

Introduction to SignalR

Page 24: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

SignalR: Features

• Ready to use libraries for server and clients

• Automatic connection management (send to all clients, to specific clients)

• Uses WebSockets when available, fallback otherwise (abstraction layer)

• Scale out to thousands of clients

Page 25: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

SignalR: Transports and fallbacks

HTML 5 transports

These transports depend on support for HTML 5. If the client browser does not support the HTML 5 standard, older transports will be used.

• WebSocket• Server Sent Events, also known as EventSource (if the browser supports Server Sent Events, which is basically

all browsers except Internet Explorer.)

Comet transports

The following transports are based on the Comet web application model, in which a browser or other client maintains a long-held HTTP request, which the server can use to push data to the client without the client specifically requesting it.

• Forever Frame• for Internet Explorer only, hidden Iframe, one-way realtime connection from server to client, connection from client to server uses a

separate connection, a new connection is created for each piece of data that needs to be sent

• Ajax long polling• no persistent connection, but instead polling the server with a request that stays open until the server responds, at which point the

connection closes, and a new connection is requested immediately, latency while the connection resets

Page 26: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

SignalR: Architecture diagram

Page 27: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

SignalR: Connections

- Simple endpoint for sending single-recipient, grouped, or broadcast messages

- Connection API (represented in .NET code by the PersistentConnection class)

- direct access to the low-level communication network that SignalR exposes

- familiar to developers who have used connection-based APIs such as Windows Communication Foundation

Page 28: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

SignalR: Hubs

- high-level pipeline built upon the Connection API

- allows client and server to call methods on each other directly

- SignalR handles dispatching across machine boundaries as if by magic

- For different types of messages, it is recommended that you use the Hub class, so that you won't have to create your own dispatching

- using the Hub, you can call methods on the clients, rather than sending an explicit message that needs to be received, interpreted, and acted upon

- familiar to developers who have used remote invocation APIs such as .NET Remoting

Page 29: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

SignalR: Supported platforms (server side)

http://blogs.msdn.com/b/timlee/archive/2013/02/27/deploy-the-signalr-getting-started-sample-as-a-windows-azure-web-site.aspx

Page 30: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

SignalR: Supported platforms (client side)

• Browsers (JavaScript)• Windows Desktop (Forms)• Silverlight• Windows Store (.NET)• Windows Store (JavaScript)• Windows Phone (IE)• Windows Phone (.NET)• Console• Web Services

• iOS (Objective-C)• …

Page 31: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

SignalR: System requirements (Windows)• On Facebook you’d say: “It’s complicated.”

• Excerpt from the documentation:

• Server: 2012*, 2008 r2, Azure Website, Windows 8*, Windows 7• .NET Framework: 4.0 / 4.5*• IIS: 7,7.5,8*, 8 Express*• Browser: IE10*• Silverlight: N/A (restr. 5+)• WP8: IE* (restr. WP8 App)

• Only * supports WebSockets…

Page 32: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

SignalR: Performance and scalability (I)

• Standard limit in IIS: 5.000 connections per CPU

• You can override this limit!

• For SignalR about 20.000 connections per CPU usually also work, depends on your appliaction…

• Special load test tool available:https://github.com/SignalR/SignalR/tree/dev/src/Microsoft.AspNet.SignalR.Crank

Page 33: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

SignalR: Performance and scalability (II)

• ScaleOut providers available since SignalR 1.1• Azure Service Bus• SQL Server• Redis

Page 34: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

SignalR: Performance and scalability (III)

• Helpful documentation on MSDN library• How to notify the user about disconnections

• How to continuously reconnect

$.connection.hub.connectionSlow(function() {notifyUserOfConnectionProblem();// Your function to notify user.

});

$.connection.hub.disconnected(function() {setTimeout(function() {

$.connection.hub.start(); }, 5000);// Restart connection after 5 seconds.

});

Page 35: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

35

Agenda

Realtime applications• Goals, use cases,

examples

Push technologies• WebSockets, Comet

SignalR• Connections and hubs• Client libraries,

supported platforms, scalability

MVVM in JavaScript• knockout.js, jQuery,

JSON, oDATA

Events in SharePoint• Overview

Bringing it all together• SharePoint 2010• SharePoint 2013• SharePoint Online

Page 36: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

Why MVVM in JavaScript?

• Separate design from code

• Two-way DataBinding for properties

• Command binding

• Templates

Page 37: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

37

Which framework to choose?

knockout.js(Microsoft)

spine.js SproutCore JavascriptMVC ember.js Angluar.js

(Google) …

Page 38: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

knockout.js

• Simplify dynamic JavaScript UIs by applying the Model-View-View Model (MVVM) pattern

• By Steve Sanderson (Microsoft employee), inspired by XAML, supports legacy browsers…

Declarative Bindings

Easily associate DOM elements with model data using a concise,

syntaxreadable

Automatic UI Refresh

When your data model's state changes,

your UI updates automatically

Dependency Tracking

Implicitly set up chains of relationships

between model data, to transform and combine

it

Templating

Quickly generate sophisticated, nested

UIs as a function of your model data

Page 39: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

knockout.jsLoad JavaScript:

DataBinding in HTML:

Define ViewModel:

Start listening:

Refresh values:

Page 40: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

knockout.jsLoad JavaScript:

DataBinding in HTML:

Define ViewModel:

Start listening:

Refresh values:

JSON?

Page 41: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

JSON – JavaScript Object Notation

• Derived from JavaScript• Language independant• Human readable• Specified by  Douglas Crockford

in RFC 4627• json.org launched in 2002

{ "id": 1, "name": "Foo", "price": 123, "tags": [ "Bar", "Eek" ], "stock": { "warehouse": 300, "retail": 20 }}

Page 42: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

oDATA – Open Data Protocol

• standardized protocol for creating and consuming data APIs

• builds on REST web services• uniform way to expose full-featured data APIs• from Microsoft, submitted as OASIS standard• AtomPub protocol as

envelope for JSON• REST methods available

on sources• http://www.odata.org/

Page 43: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

oDATA – Open Data Protocol

• standardized protocol for creating and consuming data APIs

• builds on REST web services• uniform way to expose full-featured data APIs• from Microsoft, submitted as OASIS standard• AtomPub protocol as

envelope for JSON• REST methods available

on sources• http://www.odata.org/

For example via /_vti_bin/ListData.svc in SharePoint

Page 44: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

44

Agenda

Realtime applications• Goals, use cases,

examples

Push technologies• WebSockets, Comet

SignalR• Connections and hubs• Client libraries,

supported platforms, scalability

MVVM in JavaScript• knockout.js, jQuery,

oDATA, JSON)

Events in SharePoint• Overview

Bringing it all together• SharePoint 2010• SharePoint 2013• SharePoint Online

Page 45: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

Events in SharePoint

Synchronous or

asynchronous(before or after)

Local, app or remote (new

in SP2013)

Page 46: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

Events in SharePoint

• Item eventsadding, added, deleting, deleted, updating, updated, fileconverted, filemoving, filemoved, checkingin, checkedin, checkingout, checked out, attachmentadding, attachmentadded, attachmentdeleting, attachmentdeleted

• List field events

adding, added, deleting, deleted, updating, updated

• List eventsadding, added, deleting, deleted

• Web eventsadding, provisioned, deleting, deleted, moving, moved

• Site eventsdeleting, deleted

• App events

installed, uninstalling, upgraded

• And more… EmailReceived, WorkflowCompleted, WorkflowPostponed, WorkflowStarted, WorkflowStarting, FeatureEventReceiver installation, activation, deactivation, and removal

Page 47: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

47

Agenda

Realtime applications• Goals, use cases,

examples

Push technologies• WebSockets, Comet

SignalR• Connections and hubs• Client libraries,

supported platforms, scalability

MVVM in JavaScript• knockout.js, jQuery,

JSON, oDATA

Events in SharePoint• Overview

Bringing it all together• SharePoint 2010• SharePoint 2013• SharePoint Online

Page 48: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

Integration in SharePoint (on-premises)

SharePoint 2010• uses .NET Framework 3.5• SignalR requires .NET Framework 4.0 / 4.5• Coding of a proxy necessary (WCF, HttpHandler or similar)

SharePoint 2013• uses .NET Framework 4.0

But: • SignalR attaches itself to the „App_Start“ event and registers a route „~/signalr/hubs“

(so that clients always find the hub)• In SharePoint, there is no „App_Start“! ¯\_(ツ )_/¯

Global.asax cannot be modified in a way that deployablesolution: write a HttpModule

Page 49: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

Integration in SharePoint (on-premises)

So in order to get it working you have to write:• HttpModule• SPWebConfigModificationHandler• VirtualPathProvider

Thanks to Max Melcher, you don‘t have to: Go to CodeplexSPSignalR - real-time applications with SharePoint 2013• enables you to host SignalR in a SharePoint WebApplication• web application feature, AppPool recycle,

yoursharepoint.com/signalr/hubs

Page 50: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

Weak points

• CORS (cross site scripting)• Different browsers handle this with different success… ;-)

• Proxying required

Page 51: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

Integration in SharePoint Online (I)

• Remote Event Receiver - Declaration

Page 52: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

Integration in SharePoint Online (II)

• Remote Event Receiver - Implementation

Page 53: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

Integration in SharePoint Online (III)

• SignalRHub in same project as RemoteEventReceiver

Page 54: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

54

CODE

Page 55: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

55

Agenda

Realtime applications• Goals, use cases,

examples

Push technologies• WebSockets, Comet

SignalR• Connections and hubs• Client libraries,

supported platforms, scalability

MVVM in JavaScript• knockout.js, jQuery,

JSON, oDATA

Events in SharePoint• Overview

Bringing it all together• SharePoint 2010• SharePoint 2013• SharePoint Online

Page 56: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

Resources

• Active community• Forums: http://forums.asp.net/1254.aspx• Github: We've found 493 repository results

• Official website: http://asp.net/SignalR• Videos: http://channel9.msdn.com/search?term=signalr• Trainings: http

://www.pluralsight.com/training/Courses/TableOfContents/signalr-introduction

• JavaScript libraries: Angular, http://smoothiecharts.org/• Books: Pushing Data: Integrating with ASP.NET SignalR Hubs

http://henriquat.re/server-integration/signalr/integrateWithSignalRHubs.html

• More links: https://delicious.com/c.heindel/signalr

Page 57: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

Open Source projects using SignalR

JabbR• JabbR is an open source, real-time web chat system built using ASP.NET and

SignalR. Source code is at https://github.com/davidfowl/jabbr.

ShootR• ShootR is an open source, real-time, multi-player HTML5 space shooter game, using

SignalR for real-time server-client communications. Source code is at https://github.com/NTaylorMullen/ShootR.

ElmahR = ELMAH & SignalR• A real-time monitoring solution for ASP.NET applications built with ELMAH and

SignalR.

SignalR-ObjC• A community maintained Objective-C client for SignalR, for use with iOS and Mac.

Page 58: Realtime applications for SharePoint with SignalR and knockout.js

Seite© Communardo Software GmbH · Kleiststraße 10 a · D-01129 Dresden/Germany · Fon +49 (351) 833 82-0 · Mail [email protected] · www.communardo.de

Communardo Software GmbHKleiststraße 10 a01129 Dresdenhttp://[email protected]

Phone: +49 (351) 833 820

Standort StuttgartLeinfelder Straße 6470771 Leinfelden-Echterdingen

Phone: +49 (711) 722 497 09

Thank you for listening!

58

Christian [email protected]

Mobile: +49 (0) 171 - 3123924

Twitter: @c_heindelBlog: http://blog.christian-heindel.deBlog: http://www.communardo.de/techblog/