AWS Community Day CPH - Three problems of Terraform
Â
Building Real Time Web Applications with SignalR (NoVA Code Camp 2015)
1. Using SignalR to Build Real-
time Web Applications
Kevin Griffin - @1kevgriff
http://kevgriffin.com
April 3rd, 2015
2. Thank Our Sponsors without whom Today is not Possible
Platinum
Bronze
Silver
3. HousekeepingâŚ
⢠Thanks to our host
⢠Respect your speakers and fellow attendees:
Set mobile devices to vibrate or silent
⢠Fill out session evaluations
⢠They are used in the drawings
⢠You must be present to win at the wrap-up
4. About Kevin
⢠Kevin Griffin
⢠Independent Consultant
CTO, Winsitter
⢠Twitter: @1kevgriff
Email: kevin@kevgriffin.com
⢠Microsoft ASP.NET MVP
ASPInsider
4/3/2015 @1kevgriff
17. Method #1: Interval
function updateInterface(){
// go to the server, do something
$.ajax({...});
setTimeout(10000, updateInterface);
}
setTimeout(10000, updateInterface);
Pros
Cons
⢠Works across all browsers
⢠More connections, more overhead
⢠More overhead, more bandwidth
⢠Server strain!
18. Method #2: Long Polling
function startListening(){
// note: this call can take as long
// as 120 seconds to return, depending
// on browser timeouts.
$.ajax({
url: â/blahâ,
success: function (data){
startListening();
},
failure: function (err){
startListening();
},
});
}
Pros
Cons
⢠Works across all browsers
⢠Less server overhead and resource
consumption
⢠We still have to make connections on a
regular basis.
19. Method #3: Server Sent Events
var source = new EventSource('Events');
source.onmessage = function (event) {
// the server sent us data...
};
Pros
Cons
⢠Server can push data to browser
without requiring multiple
connections.
⢠One-way communication between the
server and the client. Client cannot
send messages to server.
⢠No Internet Explorer support (at all)
20. Method #4: Web Sockets
var websocket = new WebSocket(wsUri);
websocket.onopen = function(evt) {
onOpen(evt)
};
websocket.onclose = function(evt) {
onClose(evt)
};
websocket.onmessage = function(evt) {
onMessage(evt)
};
websocket.onerror = function(evt) {
onError(evt)
};
Pros
Cons
⢠Bi-directional communication between
the server and the client.
⢠Holy grail!
⢠Limited support on older browsers.
⢠For .NET, requires IIS 8 or greater.