MVC 4.0, Knockout.js, Bootstrap and EF6 fileSignalR Hosts Host agnostic –run in asp.net or stand...
Transcript of MVC 4.0, Knockout.js, Bootstrap and EF6 fileSignalR Hosts Host agnostic –run in asp.net or stand...
ASP.NET MVChttp://nbende.wordpress.com
Agenda
• Getting started with SignalR
• Using SignalR for Dual Communication modes
Why use SignalR?
SignalR Hosts
Host agnostic – run in asp.net or stand alone
with self-host on OWIN
What to include?
Hubs and Connections
Connections – LOW LEVEL
Raw strings up and down
Broadcast to all clients, groups or individuals
Connection, reconnection and disconnection semantics
Hubs – Bit higher level
Client-server and server-client
Automatic client proxy generation
Getting started with SignalR
To Start
•
•
•
•
•
•
•
•
<body>
<div class="container">
<input type="text" id="message" />
<input type="button" id="sendmessage" value="Send" />
<input type="hidden" id="displayname" />
<ul id="discussion">
</ul>
</div>
<!--Script references. -->
<script src="Scripts/jquery-1.6.4.min.js" ></script>
<script src="Scripts/jquery.signalR-2.1.0.min.js"></script>
<script src="signalr/hubs"></script>
<!--Add script to update the page and send messages.-->
<script type="text/javascript">
$(function () {
// Declare a proxy to reference the hub.
var chat = $.connection.chatHub;
// Create a function that the hub can call to broadcast messages.
chat.client.broadcastMessage = function (name, message) {
Questions?