首页 > > > Syncfusion.ASP.NET SignalR.2013.pdf

Syncfusion.ASP.NET SignalR.2013.pdf

Syncfusion.ASP.NET SignalR.2013…

上传者: firmwu 2013-03-30 评分1 评论0 下载54 收藏10 阅读量1039 暂无简介 简介 举报

简介:本文档为《Syncfusion.ASP.NET SignalR.2013pdf》,可适用于软件工程领域,主题内容包含ASPNETSignalRIncrediblysimplerealtimefeaturesforyourwebappsJoseMAguilarASP符等。

ASPNETSignalRIncrediblysimplerealtimefeaturesforyourwebappsJoseMAguilarASPNETSIGNALRINCREDIBLYSIMPLEREALTIMEFEATURESFORYOURWEBAPPSNoticeofLiabilityTheauthorandpublisherhavemadeeveryefforttoensuretheaccuracyoftheinformationhereinHowever,theinformationcontainedinthisbookissoldwithoutwarranty,eitherexpressorimpliedNeithertheauthorsandKrasisConsultingSL,noritsdealersordistributors,willbeheldliableforanydamagestobecausedeitherdirectlyorindirectlybytheinstructionscontainedinthisbook,orbythesoftwareorhardwareproductsdescribedhereinTrademarkNoticeRatherthanindicatingeveryoccurrenceofatrademarkednameassuch,thisbookusesthenamesonlyinaneditorialfashionandtothebenefitofthetrademarkownerwithnointentionofinfringementofthetrademarkKrasisConsulting,SLwwwcampusmvpnetALLRIGHTSRESERVEDNOPARTOFTHISBOOKMAYBEREPRODUCED,INANYFORMORBYANYMEANS,WITHOUTPERMISSIONINWRITINGFROMTHEPUBLISHERISBN:iiiContentsCONTENTSIIIINTRODUCTIONInternet,Asynchrony,Multiuser…wow!HTTP:YOUARETHECLIENT,YOUARETHEBOSSHttpoperationPolling:TheanswerPush:TheservertakestheinitiativeWebsocketsServerSentEvents(akaAPIEventSource)PushtodayLongpollingForeverframeTheworldneedsmorethanjustPushSIGNALRIntroducingSignalRWhatdoesSignalRofferInstallingSignalRTwolevelsofabstractionPERSISTENTCONNECTIONSIntroductionImplementationontheserversideEventsofaPersistentConnectionSendingmessagestoclientsAsynchronouseventprocessingConnectiongroupsClientsideimplementationInitiatingtheconnectionusingtheJavascriptclientSupportforcrossdomainconnectionsSendingmessagesReceivingmessagesOthereventsavailableattheclientTransportnegotiationCompleteexample:TrackingvisitorsImplementationontheclientsideHTMLmarkupivASPNETSignalRIncrediblysimplerealtimefeaturesforyourwebappsScripts(ScriptsTrackingjs)ImplementationontheserversidePersistentconnection(TrackerConnectioncs)Startupcode(Globalasaxcs)HUBSIntroductionServerimplementationRouteregistrationCreatingHubsReceivingmessagesSendingmessagestoclientsStatemaintenanceAccessinginformationabouttherequestcontextNotificationofconnectionsanddisconnectionsManaginggroupsClientimplementationJavaScriptclientsGeneratingtheproxyEstablishingtheconnectionSendingmessagestotheserverReceivingmessagesattheserverLoggingStatemaintenanceImplementingtheclientwithoutaproxyCompleteexample:SharedwhiteboardImplementationontheclientsideHTMLmarkupScripts(ScriptsDrawingBoardjs)ImplementationontheserversideHub(DrawingBoardcs)Startupcode(Globalasaxcs)PERSISTENTCONNECTIONSANDHUBSFROMOTHERPROCESSESAccessfromotherprocessesUsingpersistentconnectionsUsinghubsCompleteexample:progressbarImplementationontheclientsideHTMLmarkupStyles(StylesProgressBarcss)Scripts(ScriptsProgressBarjs)ImplementationontheserversideHubExpensiveprocess(HardProcessAspx)Startupcode(Globalasaxcs)ContentsvSIGNALROUTSIDETHEWEBSignalRclientsAccessingservicesfromnonwebclientsHostingservicesoutsideaspnet<coder>PremiumcoachedonlinetrainingforbusydevelopersMorethancannedvideosTutoredbytheoneswhoknowmostSpecifictrainingmethodologyDirectcontactwithourStudentsOfficeofourstudentsgiveusanAwwwcampusmvpnetGotnotimeandneedtolearnnewprogrammingskillsCHAPTERINTERNET,ASYNCHRONY,MULTIUSER…WOW!Anapplicationthatcombinesinternet,asynchrony,andmultipleuserscooperatingandinteractingatthesametimealwaysdeservesa“wow!”Atsomepoint,wehavealldoubtlesslybeenamazedbytheinteractivitywhichsomemodernwebsystemscanoffer,suchasFacebook,Twitter,Gmail,GoogleDocsormanyothers,wherewereceiveupdatesalmostinrealtime,withouthavingtoreloadthepageForinstance,whenweareeditingadocumentonlineusingGoogleDocsandanotheruseralsoaccessesit,wecanseethattheyhaveenteredandfollowthechangesthattheyaremakingonthedocumentEveninamoreeverydayscenariosuchasasimplewebchat,themessagesbeingtypedbyourfriendjustappearasifbymagicBothsystemsusethesametypeofsolution:asynchronousdatatransferbetweentheserverandtheclientsinrealtimeThroughoutthesepages,wewilllearnhowtoimplementimpressivefeaturesofthiskindusingSignalR,aframeworkwhichwillfacilitateourtasktothepointofmakingittrivialForthis,wewillfirstpresentabriefreviewoftheproblemsthatwefindwhendevelopingrealtimemultiuserapplicationsWewillquicklylookatHTTPoperationanditslimitationsforsupportingthistypeofsystems,andwewillintroducethePushconceptWewillalsodescribethestandardsthatarebeingpreparedbyWCandIETF,aswellastechniquesthatwecancurrentlyuseforimplementingPushonHTTPNext,wewillintroduceSignalR,describingitsmainfeaturesandthedifferentlevelsofabstractionwhichitallowsovertheunderlyingprotocolsWewillimplementdifferentexampleswhichwillhelpusunderstanditsbasesandgiveusinsightonhowwecanusethisframeworkinourprojectsIntroductionASPNETSignalRIncrediblysimplerealtimefeaturesforyourwebappsFinally,wewilldescribehowSignalRisindependentofWebenvironments,whichmeansthatitcanbehostedinanytypeofapplicationanditsrealtimeservicescanbeconsumedfrompracticallyanytypeofsystemCHAPTERHTTPOPERATIONHTTP(HyperTextTransferProtocol)isthelanguageinwhichtheclientandtheserverofawebapplicationspeaktoeachotherItwasinitiallydefinedin,andthesimplicityandversatilityofitsdesignare,toanextent,responsibleforthesuccessandexpansionoftheWebandtheInternetasawholeItsoperationisbasedonarequestresponseschemawhichisalwaysstartedbytheclientThisprocedureisoftenreferredtoasthePullmodel:Whenaclientneedstoaccessaresourcehostedbyaserver,itpurposelyinitiatesaconnectiontoitandrequeststhedesiredinformationusingthe“language”definedbytheHTTPprotocolTheserverprocessesthisrequest,returnstheresourcethatwasaskedfor(whichmaybethecontentsofanexistingfileortheresultofrunningaprocess)andtheconnectionisinstantlyclosedIftheclientneedstoobtainanewresource,theprocessstartsagainfromthebeginning:Aconnectiontotheserverisopened,therequestfortheresourceissent,theserverprocessesit,itreturnstheresultandthenclosestheconnectionThishappenseverytimeweaccessawebpage,imagesorotherresourcesthataredownloadedbythebrowser,togiveafewexamplesFigureHTTPcommunicationbetweenabrowserandawebserverSpecificationofHTTP:http:wwwworgProtocolsHTTPspechtmlHTTP:Youaretheclient,youarethebossASPNETSignalRIncrediblysimplerealtimefeaturesforyourwebappsAsyoucanguessbylookingattheimageabove,itisasynchronousprocess:Aftersendingtherequesttotheserver,theclientislefttowait,doingnothinguntiltheresponseisavailableAlthoughthisoperationisaclassicinwebsystems,theHTTPprotocolitselfcansupporttheneedsforasynchronyofmodernapplications,owingtothetechniquesgenerallyknownasAJAX(AsynchronousJavaScriptAndXML)UsingAJAXtechniques,theexchangeofinformationbetweentheclientandtheservercanbedonewithoutleavingthecurrentpageAtanygivenmoment,theclientmayinitiateaconnectiontotheserverusingJavaScript,requestaresourceandprocessit(forexample,updatingpartofthepage)Whatistrulyadvantageousandhascontributedtotheemergenceofverydynamicandinteractiveservices,suchasFacebookorGmail,isthattheseoperationsarecarriedoutasynchronously,thatis,theusermaykeepusingthesystemwhilethelattercommunicateswiththeserverinthebackgroundtosendorreceiveinformationFigureAjaxinawebpageThisoperatingschemacontinuestouseandabidebytheHTTPprotocolandtheclientdrivenrequestresponsemodelTheclientisalwaystheonetotaketheinitiative,decidingwhentoconnecttotheserverHowever,therearescenarioswhereHTTPisnotveryefficientWiththisprotocolitisnoteasytoimplementinstantmessagingapplicationsorchatrooms,collaborationtools,multiuseronlinegamesorrealtimeinformationservices,evenwhenusingasynchronyThereasonissimple:HTTPisnotorientedtorealtimeThereareotherprotocols,suchasthepopularIRC,whichareindeedfocusedonachievingswiftercommunicationinordertooffermoredynamicandinteractiveservicesthantheoneswecanobtainusingPullInthem,theservercantaketheinitiativeandsendinformationtotheclientatanytime,withoutwaitingforittorequestitexpresslyPOLLING:THEANSWERAswebdevelopers,whenwefaceascenariowhereweneedtheservertobetheonesendinginformationtotheclientonitsowninitiative,thefirstsolutionthatintuitivelyHTTP:Youaretheclient,youarethebosscomestoourmindsistousethetechniqueknownasPollingPollingbasicallyconsistsinmakingperiodicconnectionsfromtheclienttocheckwhetherthereisanyrelevantupdateattheserverFigurePollinginachatroomserviceThemainadvantagesofthissolutionare,first,itseasyimplementation,andsecond,itsuniversalapplication:itworksineverycase,withallbrowsersandwithallservers,sinceitdoesnothingmorethanusethestandardfeaturesofHTTPAnd,ofcourse,westillusethePullmodelHowever,sometimesthepriceofpollingistoohighConstantconnectionsanddisconnectionshaveahighcostintermsofbandwidthandprocessingatbothendsofcommunicationAndtheworstpartisthatthiscostincreasesproportionallytoourneedforfasterupdatesInanapplicationprovidingrealtimeupdates,itiseasytoimaginetheloadthataserverhastobearwhenithasthousandsofusersconnectedrequestingseveralupdatespersecondTherearetechniquestomitigatetheseproblemsinsofaraspossibleOneofthemistouseadaptiveperiodicity,sothattheintervalbetweenqueriesregularlyadaptstothecurrentsystemloadortotheprobabilityofnewupdatesItisquiteeasytoimplementandcansignificantlyimproveresourceconsumptioninsomescenariosThereisamoreconservativevariantofpolling,butitdegradesuserexperienceItisthetechniquecalledpiggybacking,whichconsistsinnotmakingdel

精彩专题

热门资料

GEF-whole-upload.pdf

九型人格使用手册.doc

阿里巴巴公司DBA笔试题.txt

练习题——控制结构.doc

编辑推荐

  • 名称/格式
  • 评分
  • 下载次数
  • 资料大小
  • 上传时间

用户评论

0/200
    暂无评论
上传我的资料

相关资料换一换

  • ASP.NET MVC.pdf

  • ASP.NET(C#).pdf

  • Apress.Pro.ASP.N…

  • Apress.Pro.ASP.N…

  • Apress.Pro.ASP.N…

  • Syncfusion.ASP.N…

  • Syncfusion.HTTP_…

  • Apress.ASP.NET.M…

  • Apress.Pro.ASP.N…

资料评价:

/ 83
所需积分:1 立即下载
返回
顶部
举报
资料
关闭

温馨提示

感谢您对爱问共享资料的支持,精彩活动将尽快为您呈现,敬请期待!