Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
NetMF@WorkNetMF@WorkIoT with SignalR & .NET GadgeteerMirco Vaninihttp://mircovanini.blogspot.cominfo@proxsoft.it@MircoVani...
NetMF@WorkGrazie agli sponsor
NetMF@WorkPerché real-time e come ?SignalRConnections and HubsClientsDemoQ&ALinksAgenda
NetMF@WorkGli utenti vogliono le ultime informazioni, ORA !Twitter – live searches/updatesStock streamersAuctionsLive scor...
NetMF@WorkHTTP is an old beast…Never designed for real-time communicationsWeb is request-responseWeb is statelessHTML5 Web...
NetMF@WorkCome implementare il real-time con HTTP:• Polling.• Long Polling.• Forever Frame.• Server Sent EventsPerché real...
NetMF@WorkPerché real-time e come ?Polling: the stubborn approachServerClientTime: requests event ‘n’ seconds (fixed time)...
NetMF@WorkPolling• High overhead on requests: headers andsuch…• High overhead on response: same as before…• High latency.•...
NetMF@WorkPerché real-time e come ?Long Polling: the kind gentleman approachServerClientTime: requests event ‘n’ seconds (...
NetMF@WorkLong Polling (Hanging GET)• High overhead on requests: headers andsuch…• High overhead on response: same as befo...
NetMF@WorkPerché real-time e come ?HTTP/1.1 200 OKContent-Type: text/plainTransfer-Encoding: chunked• Server tells client ...
NetMF@WorkServer-Sent Events• Server-Sent Events (SSE) are a standard describinghow servers can initiate data transmission...
NetMF@WorkSo many options and a big Headache !Real-time: How to survive ?
NetMF@Work• Persistent Connection Abstraction communicationlibrary.• Abstracts protocol and transfer (choses the best one)...
NetMF@Work• Works everywhere !!!• Try WebSocket then fallback to:• Server Sent Events• Forever Frame• Long Polling• Bet to...
NetMF@Work• Complete rewrite of the internals for 1.0.0• Very hight performance on a single box100.000’s of messages per s...
NetMF@WorkPersistent Connections: «Low level» API,manages the connection and the «raw» stream ofdata.Hubs: «High level» AP...
NetMF@WorkSignalRInstall-Package Microsoft.AspNet.SignalR –preInstall-Package Microsoft.AspNet.SignalR.Sample -pre
NetMF@WorkCore• Microsoft.AspNet.SignalR.Core: Server side components needed tobuild SignalR endpointsMeta package• Micros...
NetMF@WorkClients• Microsoft.AspNet.SignalR.Js - Javascript client for SignalR• Microsoft.AspNet.SignalR.Client - .NET cli...
NetMF@WorkWeb Plant MonitorPlantHubPlantMonitorPlantManagerPlant DevicePlantCommandPlantDataTcpCommandListenerDemo
NetMF@WorkPagePageSchemaHUB DevicePageSendCommanddatacommand2200021000dataupdatePlaintDatacommand
NetMF@WorkQ&A
NetMF@WorkASP.NET SignalRBuilding Real-time Web Apps with ASP.NET SignalREngaging the Realtime Web with SignalRSignalR. Co...
NetMF@WorkGrazie agli sponsor
NetMF@WorkFeedback FormPer voi sono solo 10 minuti persi, pernoi è utilissimo per poter crescere!!!!http://tinyurl.com/net...
Upcoming SlideShare
Loading in …5
×

IoT with SignalR & .NET Gadgeteer - NetMF@Work

2,533 views

Published on

Internet of things è vista come una possibile evoluzione dell'uso della Rete. Gli oggetti si rendono riconoscibili e acquisiscono intelligenza grazie al fatto di poter comunicare dati su se stessi e accedere ad informazioni aggregate da parte di altri. Partendo da queste affermazioni il talk preenterà una soluzione per il controllo ed il monitoraggio centralizzato dello stato di un sistema embedded a cui sono collegati una rete di sensori e di attuatori di varia natura attraverso l'utilizzo di SignalR. Tramite questa tecnologia è possibile realizzare servizi di notifica "push" con una straordinaria reattività, il tutto utilizzando il puro e semplice http

Published in: Technology
  • Be the first to comment

IoT with SignalR & .NET Gadgeteer - NetMF@Work

  1. 1. NetMF@WorkNetMF@WorkIoT with SignalR & .NET GadgeteerMirco Vaninihttp://mircovanini.blogspot.cominfo@proxsoft.it@MircoVaniniMicrosoft MVP Windows Embedded
  2. 2. NetMF@WorkGrazie agli sponsor
  3. 3. NetMF@WorkPerché real-time e come ?SignalRConnections and HubsClientsDemoQ&ALinksAgenda
  4. 4. NetMF@WorkGli utenti vogliono le ultime informazioni, ORA !Twitter – live searches/updatesStock streamersAuctionsLive scoresReal-time notificationsInteractive gamesCollaborative appsLive user analytics.Perché real-time e come ?
  5. 5. NetMF@WorkHTTP is an old beast…Never designed for real-time communicationsWeb is request-responseWeb is statelessHTML5 WebSockets to the rescue, right?Perché real-time e come ?Extension to HTTPProvide raw socketsover HTTPFull-duplexTraverses proxiesIt’s still a draft…Not every proxy server supports itNot every webserver supports itNot every browser supports itThey are raw sockets! 
  6. 6. NetMF@WorkCome implementare il real-time con HTTP:• Polling.• Long Polling.• Forever Frame.• Server Sent EventsPerché real-time e come ?
  7. 7. NetMF@WorkPerché real-time e come ?Polling: the stubborn approachServerClientTime: requests event ‘n’ seconds (fixed time)RequestResponsedelayTwitter clients
  8. 8. NetMF@WorkPolling• High overhead on requests: headers andsuch…• High overhead on response: same as before…• High latency.• Waste of bandwith.• Waste of resources.Perché real-time e come ?
  9. 9. NetMF@WorkPerché real-time e come ?Long Polling: the kind gentleman approachServerClientTime: requests event ‘n’ seconds (variable)RequestResponseVariable delayFacebook chat
  10. 10. NetMF@WorkLong Polling (Hanging GET)• High overhead on requests: headers andsuch…• High overhead on response: same as before…• Medium latency.• Waste less of bandwith.• Waste of resources.• Better than the previous one: less requestsPerché real-time e come ?
  11. 11. NetMF@WorkPerché real-time e come ?HTTP/1.1 200 OKContent-Type: text/plainTransfer-Encoding: chunked• Server tells client that response is chuncked• Client keeps connection open untill server closes it• Server pushes data to the client followed by 0• Consumes server threads<script>eval("... ")</script>0<script>eval("... ")</script>0Forever Frame
  12. 12. NetMF@WorkServer-Sent Events• Server-Sent Events (SSE) are a standard describinghow servers can initiate data transmission towardsclients once an initial client connection has beenestablished. They are commonly used to send messageupdates or continuous data streams to a browser clientand designed to enhance native, cross-browserstreaming through a JavaScript API called EventSource,through which a client requests a particular URL in orderto receive an event stream.Stream Updates with Server-Sent EventsPerché real-time e come ?
  13. 13. NetMF@WorkSo many options and a big Headache !Real-time: How to survive ?
  14. 14. NetMF@Work• Persistent Connection Abstraction communicationlibrary.• Abstracts protocol and transfer (choses the best one).• A single programming model (a unified developmentexperience).• Extremely simple to use.• Server-side it can be hosted in different «environments»(ASP.NET, console apps, windows services, etc…).• Client-side there’s support for: Javascript clients, .NETclients, WP; provide by the community: iOS, Android.SignalR
  15. 15. NetMF@Work• Works everywhere !!!• Try WebSocket then fallback to:• Server Sent Events• Forever Frame• Long Polling• Bet to keep the logic connection up include retrylogic• Scale out to web-farmsSignalR
  16. 16. NetMF@Work• Complete rewrite of the internals for 1.0.0• Very hight performance on a single box100.000’s of messages per seconds• Very low memory overhead• Full async• 1000’s of connection per server• Cross-platform: run it on OSX or Linux withMono• Supported part of ASP.NET familySignalR
  17. 17. NetMF@WorkPersistent Connections: «Low level» API,manages the connection and the «raw» stream ofdata.Hubs: «High level» API, provide advanced supportfor internal routing (calling functions on server &clients), connection and disconnection tracking,grouping etc… Automatic client proxy generation(JavaScript)SignalR
  18. 18. NetMF@WorkSignalRInstall-Package Microsoft.AspNet.SignalR –preInstall-Package Microsoft.AspNet.SignalR.Sample -pre
  19. 19. NetMF@WorkCore• Microsoft.AspNet.SignalR.Core: Server side components needed tobuild SignalR endpointsMeta package• Microsoft.AspNet.SignalR: - A meta package that brings in everythingyou need to run it on IIS and ASP.NETHosts• Microsoft.AspNet.SignalR.SystemWeb - Pulls in the requiredpackages to host SignalR in ASP.NET (via OWIN ASP.NET host)• Microsoft.AspNet.SignalR.Owin - OWIN* host for SignalR* OWIN stands for “Open Web Interface for .NET” and it is a specification forthe communication between .NET Web Server and Web applications.SignalR packages
  20. 20. NetMF@WorkClients• Microsoft.AspNet.SignalR.Js - Javascript client for SignalR• Microsoft.AspNet.SignalR.Client - .NET client for SignalR (includesWinRT, Windows Phone 8 and Silverlight5 clients)Scaleout Buses• Microsoft.AspNet.SignalR.Redis - Redis scaleout for SignalR• Microsoft.AspNet.SignalR.ServiceBus - Service bus scaleout forSignalRSample• Microsoft.AspNet.SignalR.Sample - A sample stock ticker you canquickly and easily bring into your app to get a working sample up andrunning.SignalR packages
  21. 21. NetMF@WorkWeb Plant MonitorPlantHubPlantMonitorPlantManagerPlant DevicePlantCommandPlantDataTcpCommandListenerDemo
  22. 22. NetMF@WorkPagePageSchemaHUB DevicePageSendCommanddatacommand2200021000dataupdatePlaintDatacommand
  23. 23. NetMF@WorkQ&A
  24. 24. NetMF@WorkASP.NET SignalRBuilding Real-time Web Apps with ASP.NET SignalREngaging the Realtime Web with SignalRSignalR. Code, not toothpaste.Links
  25. 25. NetMF@WorkGrazie agli sponsor
  26. 26. NetMF@WorkFeedback FormPer voi sono solo 10 minuti persi, pernoi è utilissimo per poter crescere!!!!http://tinyurl.com/netmfwork

×