Your SlideShare is downloading. ×
IoT with SignalR & .NET Gadgeteer - NetMF@Work
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

IoT with SignalR & .NET Gadgeteer - NetMF@Work

1,589
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 …

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

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,589
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. NetMF@WorkNetMF@WorkIoT with SignalR & .NET GadgeteerMirco Vaninihttp://mircovanini.blogspot.cominfo@proxsoft.it@MircoVaniniMicrosoft MVP Windows Embedded
  • 2. NetMF@WorkGrazie agli sponsor
  • 3. NetMF@WorkPerché real-time e come ?SignalRConnections and HubsClientsDemoQ&ALinksAgenda
  • 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. 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. NetMF@WorkCome implementare il real-time con HTTP:• Polling.• Long Polling.• Forever Frame.• Server Sent EventsPerché real-time e come ?
  • 7. NetMF@WorkPerché real-time e come ?Polling: the stubborn approachServerClientTime: requests event ‘n’ seconds (fixed time)RequestResponsedelayTwitter clients
  • 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. NetMF@WorkPerché real-time e come ?Long Polling: the kind gentleman approachServerClientTime: requests event ‘n’ seconds (variable)RequestResponseVariable delayFacebook chat
  • 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. 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. 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. NetMF@WorkSo many options and a big Headache !Real-time: How to survive ?
  • 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. 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. 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. 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. NetMF@WorkSignalRInstall-Package Microsoft.AspNet.SignalR –preInstall-Package Microsoft.AspNet.SignalR.Sample -pre
  • 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. 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. NetMF@WorkWeb Plant MonitorPlantHubPlantMonitorPlantManagerPlant DevicePlantCommandPlantDataTcpCommandListenerDemo
  • 22. NetMF@WorkPagePageSchemaHUB DevicePageSendCommanddatacommand2200021000dataupdatePlaintDatacommand
  • 23. NetMF@WorkQ&A
  • 24. NetMF@WorkASP.NET SignalRBuilding Real-time Web Apps with ASP.NET SignalREngaging the Realtime Web with SignalRSignalR. Code, not toothpaste.Links
  • 25. NetMF@WorkGrazie agli sponsor
  • 26. NetMF@WorkFeedback FormPer voi sono solo 10 minuti persi, pernoi è utilissimo per poter crescere!!!!http://tinyurl.com/netmfwork