SlideShare una empresa de Scribd logo
1 de 18
ASP.NET Core SignalR &
Xamarin.Forms
Connect ASP.NET Core SignalR service via .NET Standard 2.0 C#
client library in Xamarin.Forms
ASP.NET Core SignalR
• A re-designed SignalR(http://signalr.net/) library for ASP.NET
Core 2.1 to provide real-time communication:
http://github.com/aspnet/signalr
• Not compatible with old ASP.NET SignalR.
• Existing Application that use ASP.NET SignalR or ASP.NET Core
SignalR:
• Office 365 real-time document co-authoring: http://bit.ly/2KIZjrb
• Visual Studio Live Share: http://bit.ly/2Nl8Aak
ASP.NET Core SignalR Features
• Multiple transport mechanism:
• Websocket: http://bit.ly/2MLVwtL
• Server-Send event: http://bit.ly/2KuvkXW
• Long Polling: http://bit.ly/2lOvg6t
• Hub concepts for client & server communication:
• Hub protocols: text based JSON & binary based MessagePack (
http://msgpack.org/ )
• Support 3 RPC style:
1. Server RPC call
2. Server Streaming RPC call
3. Server Call Client defined function
ASP.NET Core SignalR Features
• Hub Protocol spec is opened:
http://github.com/aspnet/SignalR/blob/master/specs/HubProtocol.m
d
• Provide many language implementation of client library:
• JavaScript: http://www.npmjs.com/package/@aspnet/signalr
• C#: http://www.nuget.org/packages/Microsoft.AspNetCore.SignalR.Client/
• C++ & Java Client are under development and will release stable version with
ASP.NET Core 2.2 timeline.
• 3rd Party:
• Swift : http://github.com/moozzyk/SignalR-Client-Swift
• RxJs enabled Js client: http:///www.npmjs.com/package/@ssv/signalr-client
ASP.NET Core SignalR Features
• Hub support ASP.NET Core Authentication mechanism
• Cookie
• JWT Auth Token
• Service instance can be scale-out using Redis on-premises,
using Azure SignalR Service(https://aka.ms/signalr_service ) in
cloud.
• Note: ASP.NET SignalR can scale-out via Azure Service Bus, but
there’s no plan for ASP.NET Core SignalR right now:
https://github.com/aspnet/SignalR/issues/1676
Xamarin & ASP.NET Core SignalR
• Using ASP.NET Core SignalR technology, we can build a cross
platform/device broadcasting system via Xamarin.
• Demo code:
http://bit.ly/2KHv57D
Xamarin.Forms as Core SignalR client
Using following Nuget Package in Xamarin.Forms project:
• Microsoft.AspNetCore.SignalR.Client:
https://www.nuget.org/packages/Microsoft.AspNetCore.SignalR.Client/
• Microsoft.Extensions.Logging.Console:
(for iOS & Android logging)
https://www.nuget.org/packages/Microsoft.Extensions.Logging.Console/
• Microsoft.Extensions.Logging.Debug:
(for UWP logging)
https://www.nuget.org/packages/Microsoft.Extensions.Logging.Debug/
• System.Threading.Channels:
(for invoke Server Streaming RPC call)
https://www.nuget.org/packages/System.Threading.Channels/
Xamarin.Forms as Core SignalR client
• Hub: a connection joint that client & sever can call their defined
methods mutually.
Server
Client #1
Client #2
Client #3
Hub
Xamarin.Forms as Core SignalR client
• On Client side, use “HubConnection(http://bit.ly/2tRduE6)” to
access the Server Method defined in Hub.
• To create HubConnection object, using
“HubConnectionBuilder(http://bit.ly/2MLLGYC)” to create.
• HubConnectionBuilder has many Fluent-API style extension
method to configure it. (ASP.NET Core configuration style)
Xamarin.Forms as Core SignalR client
• This kind of “Code as Configuration” coding style is very
modifiable based on demand, and can be refactored to a clear
style using Action Delegate:
http://www.tutorialsteacher.com/csharp/csharp-action-delegate
Xamarin.Forms as Core SignalR client
• Once HubConneciton instance is created, call StartAsync() to
connect to remote ASP.NET Core SignalR server, call
StopAsync() or DisposeAsync() to tear down connection,
HubConnection object cannot be re-used, must create it every
time when starting a new connection.
Xamarin.Forms as Core SignalR client
• Server RPC call : (http://bit.ly/2KKDXN8)
• Use HubConnectionExtensions.InvokeAsync<TResult>()
extension method(http://bit.ly/2MOpy03 ) to get RPC call result.
Xamarin.Forms as Core SignalR client
• Server Streaming RPC call: http://bit.ly/2tQLbp4
• Use
HubConnectionExtensions.StreamAsChannelAsync<TResult>()
extension method (http://bit.ly/2zfC1bc),
• Which needs additional New Type called
“ChannelReader(http://bit.ly/2MJARXi)” from .NET Core runtime, that
is not documented in official docs yet.
Channel(http://bit.ly/2KJAkXG) is a kind of Data Queue that
mimics Go’s “Buffered Channel(http://bit.ly/2IRo56K)” concept:
https://github.com/stephentoub/corefxlab/blob/master/src/Syst
em.Threading.Tasks.Channels/README.md
Xamarin.Forms as Core SignalR client
• Server Streaming RPC call can be cancelled from client via Set
Cancellation token parameter in
HubConnectionExtensions.StreamAsChannelAsync<TResult>()
Xamarin.Forms as Core SignalR client
• Server Call Client defined function: (http://bit.ly/2lT4cDf)
Register client function using HubConnection.On() or
HubConnectionExtensions.On(http://bit.ly/2IQ0Auw) API:
Other Notes
Xamarin Client need to use latest preview of Visual Studio 2017 15.8
preview 3 or Visual Studio for Mac 7.6 preview 3:
https://github.com/aspnet/Announcements/issues/305
• UWP on Windows 10 Mobile OS is not support since .NET Standard
2.0 support for Windows 10 UWP comes in 2017 Fall Creators
Update.
• UWP logging has to use AddDebug(), not AddConsole().
• JWT Authentication is configured on HubConnectionBuilder’s
WithUrl() extension method:
https://github.com/aspnet/SignalR/blob/948ebf34ece11918804f443b65c6a053dfc
8f35c/samples/JwtClientSample/Program.cs#L38
• Local debugging & testing can use ngrok(http://ngrok.com) for real
device connection.
Resources
• Code Magazine 2018 Jul/Aug issue:
http://www.codemag.com/Magazine/Issue/JulAug18
• Official doc: http://docs.microsoft.com/en-
us/aspnet/core/signalr/dotnet-client
• ASP.NET Core SignalR source code repo:
http://github.com/aspnet/signalr
• ASP.NET Core sample code repo:
http://github.com/aspnet/SignalR-samples
• Build 2018 Introduction Video:
https://channel9.msdn.com/Events/Build/2018/BRK2147

Más contenido relacionado

La actualidad más candente

Webinar: 99 Ways to Enrich Streaming Data with Apache Flink - Konstantin Knauf
Webinar: 99 Ways to Enrich Streaming Data with Apache Flink - Konstantin KnaufWebinar: 99 Ways to Enrich Streaming Data with Apache Flink - Konstantin Knauf
Webinar: 99 Ways to Enrich Streaming Data with Apache Flink - Konstantin KnaufVerverica
 
Cortex: Prometheus as a Service, One Year On
Cortex: Prometheus as a Service, One Year OnCortex: Prometheus as a Service, One Year On
Cortex: Prometheus as a Service, One Year OnKausal
 
Practical tips and tricks for Apache Kafka messages integration | Francesco T...
Practical tips and tricks for Apache Kafka messages integration | Francesco T...Practical tips and tricks for Apache Kafka messages integration | Francesco T...
Practical tips and tricks for Apache Kafka messages integration | Francesco T...HostedbyConfluent
 
Making clouds: turning opennebula into a product
Making clouds: turning opennebula into a productMaking clouds: turning opennebula into a product
Making clouds: turning opennebula into a productCarlo Daffara
 
20170701 kkbox的團隊協作方式
20170701 kkbox的團隊協作方式20170701 kkbox的團隊協作方式
20170701 kkbox的團隊協作方式CQD
 
Flink Forward San Francisco 2019: Building production Flink jobs with Airstre...
Flink Forward San Francisco 2019: Building production Flink jobs with Airstre...Flink Forward San Francisco 2019: Building production Flink jobs with Airstre...
Flink Forward San Francisco 2019: Building production Flink jobs with Airstre...Flink Forward
 
Towards Flink 2.0: Unified Batch & Stream Processing - Aljoscha Krettek, Ver...
Towards Flink 2.0:  Unified Batch & Stream Processing - Aljoscha Krettek, Ver...Towards Flink 2.0:  Unified Batch & Stream Processing - Aljoscha Krettek, Ver...
Towards Flink 2.0: Unified Batch & Stream Processing - Aljoscha Krettek, Ver...Flink Forward
 
Windows Azure PowerShell Cmdlets
Windows Azure PowerShell CmdletsWindows Azure PowerShell Cmdlets
Windows Azure PowerShell CmdletsPavel Revenkov
 
NGINX_conf_2016_talk
NGINX_conf_2016_talkNGINX_conf_2016_talk
NGINX_conf_2016_talkkunalvjti
 
Kubernetes + Operator + PaaSTA = Flink @ Yelp - Antonio Verardi, Yelp
Kubernetes + Operator + PaaSTA = Flink @ Yelp -  Antonio Verardi, YelpKubernetes + Operator + PaaSTA = Flink @ Yelp -  Antonio Verardi, Yelp
Kubernetes + Operator + PaaSTA = Flink @ Yelp - Antonio Verardi, YelpFlink Forward
 
CNTUG x SDN Meetup #33 Talk 1: 從 Cilium 認識 cgroup ebpf - Ruian
CNTUG x SDN Meetup #33  Talk 1: 從 Cilium 認識 cgroup ebpf - RuianCNTUG x SDN Meetup #33  Talk 1: 從 Cilium 認識 cgroup ebpf - Ruian
CNTUG x SDN Meetup #33 Talk 1: 從 Cilium 認識 cgroup ebpf - RuianHanLing Shen
 
Scalatra scala meetup
Scalatra scala meetupScalatra scala meetup
Scalatra scala meetupTomasz Lelek
 
The Conf 2019 - Elixir - Emerson Macedo
The Conf 2019 - Elixir - Emerson MacedoThe Conf 2019 - Elixir - Emerson Macedo
The Conf 2019 - Elixir - Emerson MacedoEmerson Macedo
 
Monitoring on Kubernetes using prometheus
Monitoring on Kubernetes using prometheusMonitoring on Kubernetes using prometheus
Monitoring on Kubernetes using prometheusChandresh Pancholi
 
Flink Connector Development Tips & Tricks
Flink Connector Development Tips & TricksFlink Connector Development Tips & Tricks
Flink Connector Development Tips & TricksEron Wright
 
Getting Started Monitoring with Prometheus and Grafana
Getting Started Monitoring with Prometheus and GrafanaGetting Started Monitoring with Prometheus and Grafana
Getting Started Monitoring with Prometheus and GrafanaSyah Dwi Prihatmoko
 
Streaming your Lyft Ride Prices - Flink Forward SF 2019
Streaming your Lyft Ride Prices - Flink Forward SF 2019Streaming your Lyft Ride Prices - Flink Forward SF 2019
Streaming your Lyft Ride Prices - Flink Forward SF 2019Thomas Weise
 
A new tool for measuring performance in Drupal 8 - Drupal Dev Days Montpellier
A new tool for measuring performance in Drupal 8 - Drupal Dev Days MontpellierA new tool for measuring performance in Drupal 8 - Drupal Dev Days Montpellier
A new tool for measuring performance in Drupal 8 - Drupal Dev Days MontpellierLuca Lusso
 
Flink Forward Berlin 2017: Aljoscha Krettek - Talk Python to me: Stream Proce...
Flink Forward Berlin 2017: Aljoscha Krettek - Talk Python to me: Stream Proce...Flink Forward Berlin 2017: Aljoscha Krettek - Talk Python to me: Stream Proce...
Flink Forward Berlin 2017: Aljoscha Krettek - Talk Python to me: Stream Proce...Flink Forward
 

La actualidad más candente (20)

Webinar: 99 Ways to Enrich Streaming Data with Apache Flink - Konstantin Knauf
Webinar: 99 Ways to Enrich Streaming Data with Apache Flink - Konstantin KnaufWebinar: 99 Ways to Enrich Streaming Data with Apache Flink - Konstantin Knauf
Webinar: 99 Ways to Enrich Streaming Data with Apache Flink - Konstantin Knauf
 
Cortex: Prometheus as a Service, One Year On
Cortex: Prometheus as a Service, One Year OnCortex: Prometheus as a Service, One Year On
Cortex: Prometheus as a Service, One Year On
 
Practical tips and tricks for Apache Kafka messages integration | Francesco T...
Practical tips and tricks for Apache Kafka messages integration | Francesco T...Practical tips and tricks for Apache Kafka messages integration | Francesco T...
Practical tips and tricks for Apache Kafka messages integration | Francesco T...
 
Making clouds: turning opennebula into a product
Making clouds: turning opennebula into a productMaking clouds: turning opennebula into a product
Making clouds: turning opennebula into a product
 
20170701 kkbox的團隊協作方式
20170701 kkbox的團隊協作方式20170701 kkbox的團隊協作方式
20170701 kkbox的團隊協作方式
 
Flink Forward San Francisco 2019: Building production Flink jobs with Airstre...
Flink Forward San Francisco 2019: Building production Flink jobs with Airstre...Flink Forward San Francisco 2019: Building production Flink jobs with Airstre...
Flink Forward San Francisco 2019: Building production Flink jobs with Airstre...
 
Towards Flink 2.0: Unified Batch & Stream Processing - Aljoscha Krettek, Ver...
Towards Flink 2.0:  Unified Batch & Stream Processing - Aljoscha Krettek, Ver...Towards Flink 2.0:  Unified Batch & Stream Processing - Aljoscha Krettek, Ver...
Towards Flink 2.0: Unified Batch & Stream Processing - Aljoscha Krettek, Ver...
 
Windows Azure PowerShell Cmdlets
Windows Azure PowerShell CmdletsWindows Azure PowerShell Cmdlets
Windows Azure PowerShell Cmdlets
 
NGINX_conf_2016_talk
NGINX_conf_2016_talkNGINX_conf_2016_talk
NGINX_conf_2016_talk
 
Kubernetes + Operator + PaaSTA = Flink @ Yelp - Antonio Verardi, Yelp
Kubernetes + Operator + PaaSTA = Flink @ Yelp -  Antonio Verardi, YelpKubernetes + Operator + PaaSTA = Flink @ Yelp -  Antonio Verardi, Yelp
Kubernetes + Operator + PaaSTA = Flink @ Yelp - Antonio Verardi, Yelp
 
CNTUG x SDN Meetup #33 Talk 1: 從 Cilium 認識 cgroup ebpf - Ruian
CNTUG x SDN Meetup #33  Talk 1: 從 Cilium 認識 cgroup ebpf - RuianCNTUG x SDN Meetup #33  Talk 1: 從 Cilium 認識 cgroup ebpf - Ruian
CNTUG x SDN Meetup #33 Talk 1: 從 Cilium 認識 cgroup ebpf - Ruian
 
Scalatra scala meetup
Scalatra scala meetupScalatra scala meetup
Scalatra scala meetup
 
The Conf 2019 - Elixir - Emerson Macedo
The Conf 2019 - Elixir - Emerson MacedoThe Conf 2019 - Elixir - Emerson Macedo
The Conf 2019 - Elixir - Emerson Macedo
 
Monitoring on Kubernetes using prometheus
Monitoring on Kubernetes using prometheusMonitoring on Kubernetes using prometheus
Monitoring on Kubernetes using prometheus
 
Flink Connector Development Tips & Tricks
Flink Connector Development Tips & TricksFlink Connector Development Tips & Tricks
Flink Connector Development Tips & Tricks
 
Getting Started Monitoring with Prometheus and Grafana
Getting Started Monitoring with Prometheus and GrafanaGetting Started Monitoring with Prometheus and Grafana
Getting Started Monitoring with Prometheus and Grafana
 
Streaming your Lyft Ride Prices - Flink Forward SF 2019
Streaming your Lyft Ride Prices - Flink Forward SF 2019Streaming your Lyft Ride Prices - Flink Forward SF 2019
Streaming your Lyft Ride Prices - Flink Forward SF 2019
 
A new tool for measuring performance in Drupal 8 - Drupal Dev Days Montpellier
A new tool for measuring performance in Drupal 8 - Drupal Dev Days MontpellierA new tool for measuring performance in Drupal 8 - Drupal Dev Days Montpellier
A new tool for measuring performance in Drupal 8 - Drupal Dev Days Montpellier
 
gogul
gogulgogul
gogul
 
Flink Forward Berlin 2017: Aljoscha Krettek - Talk Python to me: Stream Proce...
Flink Forward Berlin 2017: Aljoscha Krettek - Talk Python to me: Stream Proce...Flink Forward Berlin 2017: Aljoscha Krettek - Talk Python to me: Stream Proce...
Flink Forward Berlin 2017: Aljoscha Krettek - Talk Python to me: Stream Proce...
 

Similar a Xamarin Form using ASP.NET Core SignalR client

.NET Core Today and Tomorrow
.NET Core Today and Tomorrow.NET Core Today and Tomorrow
.NET Core Today and TomorrowJon Galloway
 
Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Deepak Gupta
 
ASP.NET Core 3.0 Deep Dive
ASP.NET Core 3.0 Deep DiveASP.NET Core 3.0 Deep Dive
ASP.NET Core 3.0 Deep DiveJon Galloway
 
Fancy Features in Asp.Net Core SignalR
Fancy Features in Asp.Net Core SignalRFancy Features in Asp.Net Core SignalR
Fancy Features in Asp.Net Core SignalRVladimir Georgiev
 
Asp.net and .Net Framework ppt presentation
Asp.net and .Net Framework ppt presentationAsp.net and .Net Framework ppt presentation
Asp.net and .Net Framework ppt presentationabhishek singh
 
Asynchrone Echtzeitanwendungen für SharePoint mit SignalR und knockout.js
Asynchrone Echtzeitanwendungen für SharePoint mit SignalR und knockout.jsAsynchrone Echtzeitanwendungen für SharePoint mit SignalR und knockout.js
Asynchrone Echtzeitanwendungen für SharePoint mit SignalR und knockout.jsChristian Heindel
 
Building Real Time Applications with ASP.NET SignalR 2.0 by Rachel Appel
Building Real Time Applications with ASP.NET SignalR 2.0 by Rachel AppelBuilding Real Time Applications with ASP.NET SignalR 2.0 by Rachel Appel
Building Real Time Applications with ASP.NET SignalR 2.0 by Rachel Appel.NET Conf UY
 
SignalR: Add real-time to your applications
SignalR: Add real-time to your applicationsSignalR: Add real-time to your applications
SignalR: Add real-time to your applicationsEugene Zharkov
 
What you need to know about .NET Core 3.0 and beyond
What you need to know about .NET Core 3.0 and beyondWhat you need to know about .NET Core 3.0 and beyond
What you need to know about .NET Core 3.0 and beyondJon Galloway
 
Building high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache ThriftBuilding high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache ThriftRX-M Enterprises LLC
 
IoT with SignalR & .NET Gadgeteer - NetMF@Work
IoT with SignalR & .NET Gadgeteer - NetMF@WorkIoT with SignalR & .NET Gadgeteer - NetMF@Work
IoT with SignalR & .NET Gadgeteer - NetMF@WorkMirco Vanini
 
Hyperledger Composer architecture
Hyperledger Composer architectureHyperledger Composer architecture
Hyperledger Composer architectureSimon Stone
 
44CON 2014 - Binary Protocol Analysis with CANAPE, James Forshaw
44CON 2014 - Binary Protocol Analysis with CANAPE, James Forshaw44CON 2014 - Binary Protocol Analysis with CANAPE, James Forshaw
44CON 2014 - Binary Protocol Analysis with CANAPE, James Forshaw44CON
 
SignalR Dublin ALT.NET
SignalR Dublin ALT.NETSignalR Dublin ALT.NET
SignalR Dublin ALT.NETDorin Manoli
 
Stream Processing with Apache Kafka and .NET
Stream Processing with Apache Kafka and .NETStream Processing with Apache Kafka and .NET
Stream Processing with Apache Kafka and .NETconfluent
 
.NET Core 3.0 - What's new?
.NET Core 3.0 - What's new?.NET Core 3.0 - What's new?
.NET Core 3.0 - What's new?Christian Nagel
 
What's New in .Net 4.5
What's New in .Net 4.5What's New in .Net 4.5
What's New in .Net 4.5Malam Team
 
.NET & C# Updates Fall 2019
.NET & C# Updates Fall 2019.NET & C# Updates Fall 2019
.NET & C# Updates Fall 2019Marco Parenzan
 

Similar a Xamarin Form using ASP.NET Core SignalR client (20)

.NET Core Today and Tomorrow
.NET Core Today and Tomorrow.NET Core Today and Tomorrow
.NET Core Today and Tomorrow
 
Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)
 
ASP.NET Core 3.0 Deep Dive
ASP.NET Core 3.0 Deep DiveASP.NET Core 3.0 Deep Dive
ASP.NET Core 3.0 Deep Dive
 
Introduction to SignalR
Introduction to SignalRIntroduction to SignalR
Introduction to SignalR
 
Fancy Features in Asp.Net Core SignalR
Fancy Features in Asp.Net Core SignalRFancy Features in Asp.Net Core SignalR
Fancy Features in Asp.Net Core SignalR
 
Asp.net and .Net Framework ppt presentation
Asp.net and .Net Framework ppt presentationAsp.net and .Net Framework ppt presentation
Asp.net and .Net Framework ppt presentation
 
Asynchrone Echtzeitanwendungen für SharePoint mit SignalR und knockout.js
Asynchrone Echtzeitanwendungen für SharePoint mit SignalR und knockout.jsAsynchrone Echtzeitanwendungen für SharePoint mit SignalR und knockout.js
Asynchrone Echtzeitanwendungen für SharePoint mit SignalR und knockout.js
 
Building Real Time Applications with ASP.NET SignalR 2.0 by Rachel Appel
Building Real Time Applications with ASP.NET SignalR 2.0 by Rachel AppelBuilding Real Time Applications with ASP.NET SignalR 2.0 by Rachel Appel
Building Real Time Applications with ASP.NET SignalR 2.0 by Rachel Appel
 
SignalR: Add real-time to your applications
SignalR: Add real-time to your applicationsSignalR: Add real-time to your applications
SignalR: Add real-time to your applications
 
What you need to know about .NET Core 3.0 and beyond
What you need to know about .NET Core 3.0 and beyondWhat you need to know about .NET Core 3.0 and beyond
What you need to know about .NET Core 3.0 and beyond
 
Building high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache ThriftBuilding high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache Thrift
 
IoT with SignalR & .NET Gadgeteer - NetMF@Work
IoT with SignalR & .NET Gadgeteer - NetMF@WorkIoT with SignalR & .NET Gadgeteer - NetMF@Work
IoT with SignalR & .NET Gadgeteer - NetMF@Work
 
Hyperledger Composer architecture
Hyperledger Composer architectureHyperledger Composer architecture
Hyperledger Composer architecture
 
44CON 2014 - Binary Protocol Analysis with CANAPE, James Forshaw
44CON 2014 - Binary Protocol Analysis with CANAPE, James Forshaw44CON 2014 - Binary Protocol Analysis with CANAPE, James Forshaw
44CON 2014 - Binary Protocol Analysis with CANAPE, James Forshaw
 
SignalR Dublin ALT.NET
SignalR Dublin ALT.NETSignalR Dublin ALT.NET
SignalR Dublin ALT.NET
 
Stream Processing with Apache Kafka and .NET
Stream Processing with Apache Kafka and .NETStream Processing with Apache Kafka and .NET
Stream Processing with Apache Kafka and .NET
 
.NET Core 3.0 - What's new?
.NET Core 3.0 - What's new?.NET Core 3.0 - What's new?
.NET Core 3.0 - What's new?
 
What's New in .Net 4.5
What's New in .Net 4.5What's New in .Net 4.5
What's New in .Net 4.5
 
.NET & C# Updates Fall 2019
.NET & C# Updates Fall 2019.NET & C# Updates Fall 2019
.NET & C# Updates Fall 2019
 
Signal R 2015
Signal R 2015Signal R 2015
Signal R 2015
 

Más de Chen Yu Pao

HoloLens 2的 MR(Mixed Reality)開發入門
HoloLens 2的 MR(Mixed Reality)開發入門HoloLens 2的 MR(Mixed Reality)開發入門
HoloLens 2的 MR(Mixed Reality)開發入門Chen Yu Pao
 
SkiaSharp on Xamarin Forms
SkiaSharp on Xamarin FormsSkiaSharp on Xamarin Forms
SkiaSharp on Xamarin FormsChen Yu Pao
 
ReactiveUI Xamarin.Forms
ReactiveUI Xamarin.FormsReactiveUI Xamarin.Forms
ReactiveUI Xamarin.FormsChen Yu Pao
 
WebSocket on client & server using websocket-sharp & ASP.NET Core
WebSocket on client & server using websocket-sharp & ASP.NET CoreWebSocket on client & server using websocket-sharp & ASP.NET Core
WebSocket on client & server using websocket-sharp & ASP.NET CoreChen Yu Pao
 
使用JetBrains Rider開發Xamarin Forms
使用JetBrains Rider開發Xamarin Forms使用JetBrains Rider開發Xamarin Forms
使用JetBrains Rider開發Xamarin FormsChen Yu Pao
 
Xamarin ARKit Introduction 01
Xamarin ARKit Introduction 01Xamarin ARKit Introduction 01
Xamarin ARKit Introduction 01Chen Yu Pao
 
Xamarin native forms
Xamarin native formsXamarin native forms
Xamarin native formsChen Yu Pao
 
Xamarin的Azure後端懶人包
Xamarin的Azure後端懶人包Xamarin的Azure後端懶人包
Xamarin的Azure後端懶人包Chen Yu Pao
 
Proto actor 串接 Go 與 C# 簡易上手
Proto actor 串接 Go 與 C# 簡易上手Proto actor 串接 Go 與 C# 簡易上手
Proto actor 串接 Go 與 C# 簡易上手Chen Yu Pao
 

Más de Chen Yu Pao (9)

HoloLens 2的 MR(Mixed Reality)開發入門
HoloLens 2的 MR(Mixed Reality)開發入門HoloLens 2的 MR(Mixed Reality)開發入門
HoloLens 2的 MR(Mixed Reality)開發入門
 
SkiaSharp on Xamarin Forms
SkiaSharp on Xamarin FormsSkiaSharp on Xamarin Forms
SkiaSharp on Xamarin Forms
 
ReactiveUI Xamarin.Forms
ReactiveUI Xamarin.FormsReactiveUI Xamarin.Forms
ReactiveUI Xamarin.Forms
 
WebSocket on client & server using websocket-sharp & ASP.NET Core
WebSocket on client & server using websocket-sharp & ASP.NET CoreWebSocket on client & server using websocket-sharp & ASP.NET Core
WebSocket on client & server using websocket-sharp & ASP.NET Core
 
使用JetBrains Rider開發Xamarin Forms
使用JetBrains Rider開發Xamarin Forms使用JetBrains Rider開發Xamarin Forms
使用JetBrains Rider開發Xamarin Forms
 
Xamarin ARKit Introduction 01
Xamarin ARKit Introduction 01Xamarin ARKit Introduction 01
Xamarin ARKit Introduction 01
 
Xamarin native forms
Xamarin native formsXamarin native forms
Xamarin native forms
 
Xamarin的Azure後端懶人包
Xamarin的Azure後端懶人包Xamarin的Azure後端懶人包
Xamarin的Azure後端懶人包
 
Proto actor 串接 Go 與 C# 簡易上手
Proto actor 串接 Go 與 C# 簡易上手Proto actor 串接 Go 與 C# 簡易上手
Proto actor 串接 Go 與 C# 簡易上手
 

Último

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 

Último (20)

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 

Xamarin Form using ASP.NET Core SignalR client

  • 1. ASP.NET Core SignalR & Xamarin.Forms Connect ASP.NET Core SignalR service via .NET Standard 2.0 C# client library in Xamarin.Forms
  • 2. ASP.NET Core SignalR • A re-designed SignalR(http://signalr.net/) library for ASP.NET Core 2.1 to provide real-time communication: http://github.com/aspnet/signalr • Not compatible with old ASP.NET SignalR. • Existing Application that use ASP.NET SignalR or ASP.NET Core SignalR: • Office 365 real-time document co-authoring: http://bit.ly/2KIZjrb • Visual Studio Live Share: http://bit.ly/2Nl8Aak
  • 3. ASP.NET Core SignalR Features • Multiple transport mechanism: • Websocket: http://bit.ly/2MLVwtL • Server-Send event: http://bit.ly/2KuvkXW • Long Polling: http://bit.ly/2lOvg6t • Hub concepts for client & server communication: • Hub protocols: text based JSON & binary based MessagePack ( http://msgpack.org/ ) • Support 3 RPC style: 1. Server RPC call 2. Server Streaming RPC call 3. Server Call Client defined function
  • 4. ASP.NET Core SignalR Features • Hub Protocol spec is opened: http://github.com/aspnet/SignalR/blob/master/specs/HubProtocol.m d • Provide many language implementation of client library: • JavaScript: http://www.npmjs.com/package/@aspnet/signalr • C#: http://www.nuget.org/packages/Microsoft.AspNetCore.SignalR.Client/ • C++ & Java Client are under development and will release stable version with ASP.NET Core 2.2 timeline. • 3rd Party: • Swift : http://github.com/moozzyk/SignalR-Client-Swift • RxJs enabled Js client: http:///www.npmjs.com/package/@ssv/signalr-client
  • 5. ASP.NET Core SignalR Features • Hub support ASP.NET Core Authentication mechanism • Cookie • JWT Auth Token • Service instance can be scale-out using Redis on-premises, using Azure SignalR Service(https://aka.ms/signalr_service ) in cloud. • Note: ASP.NET SignalR can scale-out via Azure Service Bus, but there’s no plan for ASP.NET Core SignalR right now: https://github.com/aspnet/SignalR/issues/1676
  • 6. Xamarin & ASP.NET Core SignalR • Using ASP.NET Core SignalR technology, we can build a cross platform/device broadcasting system via Xamarin. • Demo code: http://bit.ly/2KHv57D
  • 7. Xamarin.Forms as Core SignalR client Using following Nuget Package in Xamarin.Forms project: • Microsoft.AspNetCore.SignalR.Client: https://www.nuget.org/packages/Microsoft.AspNetCore.SignalR.Client/ • Microsoft.Extensions.Logging.Console: (for iOS & Android logging) https://www.nuget.org/packages/Microsoft.Extensions.Logging.Console/ • Microsoft.Extensions.Logging.Debug: (for UWP logging) https://www.nuget.org/packages/Microsoft.Extensions.Logging.Debug/ • System.Threading.Channels: (for invoke Server Streaming RPC call) https://www.nuget.org/packages/System.Threading.Channels/
  • 8. Xamarin.Forms as Core SignalR client • Hub: a connection joint that client & sever can call their defined methods mutually. Server Client #1 Client #2 Client #3 Hub
  • 9. Xamarin.Forms as Core SignalR client • On Client side, use “HubConnection(http://bit.ly/2tRduE6)” to access the Server Method defined in Hub. • To create HubConnection object, using “HubConnectionBuilder(http://bit.ly/2MLLGYC)” to create. • HubConnectionBuilder has many Fluent-API style extension method to configure it. (ASP.NET Core configuration style)
  • 10.
  • 11. Xamarin.Forms as Core SignalR client • This kind of “Code as Configuration” coding style is very modifiable based on demand, and can be refactored to a clear style using Action Delegate: http://www.tutorialsteacher.com/csharp/csharp-action-delegate
  • 12. Xamarin.Forms as Core SignalR client • Once HubConneciton instance is created, call StartAsync() to connect to remote ASP.NET Core SignalR server, call StopAsync() or DisposeAsync() to tear down connection, HubConnection object cannot be re-used, must create it every time when starting a new connection.
  • 13. Xamarin.Forms as Core SignalR client • Server RPC call : (http://bit.ly/2KKDXN8) • Use HubConnectionExtensions.InvokeAsync<TResult>() extension method(http://bit.ly/2MOpy03 ) to get RPC call result.
  • 14. Xamarin.Forms as Core SignalR client • Server Streaming RPC call: http://bit.ly/2tQLbp4 • Use HubConnectionExtensions.StreamAsChannelAsync<TResult>() extension method (http://bit.ly/2zfC1bc), • Which needs additional New Type called “ChannelReader(http://bit.ly/2MJARXi)” from .NET Core runtime, that is not documented in official docs yet. Channel(http://bit.ly/2KJAkXG) is a kind of Data Queue that mimics Go’s “Buffered Channel(http://bit.ly/2IRo56K)” concept: https://github.com/stephentoub/corefxlab/blob/master/src/Syst em.Threading.Tasks.Channels/README.md
  • 15. Xamarin.Forms as Core SignalR client • Server Streaming RPC call can be cancelled from client via Set Cancellation token parameter in HubConnectionExtensions.StreamAsChannelAsync<TResult>()
  • 16. Xamarin.Forms as Core SignalR client • Server Call Client defined function: (http://bit.ly/2lT4cDf) Register client function using HubConnection.On() or HubConnectionExtensions.On(http://bit.ly/2IQ0Auw) API:
  • 17. Other Notes Xamarin Client need to use latest preview of Visual Studio 2017 15.8 preview 3 or Visual Studio for Mac 7.6 preview 3: https://github.com/aspnet/Announcements/issues/305 • UWP on Windows 10 Mobile OS is not support since .NET Standard 2.0 support for Windows 10 UWP comes in 2017 Fall Creators Update. • UWP logging has to use AddDebug(), not AddConsole(). • JWT Authentication is configured on HubConnectionBuilder’s WithUrl() extension method: https://github.com/aspnet/SignalR/blob/948ebf34ece11918804f443b65c6a053dfc 8f35c/samples/JwtClientSample/Program.cs#L38 • Local debugging & testing can use ngrok(http://ngrok.com) for real device connection.
  • 18. Resources • Code Magazine 2018 Jul/Aug issue: http://www.codemag.com/Magazine/Issue/JulAug18 • Official doc: http://docs.microsoft.com/en- us/aspnet/core/signalr/dotnet-client • ASP.NET Core SignalR source code repo: http://github.com/aspnet/signalr • ASP.NET Core sample code repo: http://github.com/aspnet/SignalR-samples • Build 2018 Introduction Video: https://channel9.msdn.com/Events/Build/2018/BRK2147