关闭

关闭

封号提示

内容

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

Syncfusion.ASP.NET SignalR.2013.pdf

Syncfusion.ASP.NET SignalR.2013…

上传者: firmwu 2013-03-30 评分 5 0 229 31 1039 暂无简介 简介 举报

简介:本文档为《Syncfusion.ASP.NET SignalR.2013pdf》,可适用于IT/计算机领域,主题内容包含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

类似资料

编辑推荐

篆书书写入门:篆书概述.pdf

中国绘画鉴赏图典.pdf

Data Analysis A Bayesian Tutorial.pdf

政府未来的治理模式.pdf

卡耐基口才学(全).pdf

职业精品

精彩专题

上传我的资料

精选资料

热门资料排行换一换

  • 植物的象征.pdf

  • 15《神秘的占候:古代物候学研究…

  • 11《神秘的幻术:降神附体风俗探…

  • 18《神秘的符箓咒语:民间自疗法…

  • 05《神秘的星象:冥冥天机的千古…

  • 赵国文化.pdf

  • 三坊七巷(新长篇小说).pdf

  • 唐才子传校笺+第4册.pdf

  • [那个姐姐教我们的事].沉奇岚.…

  • 资料评价:

    / 83
    所需积分:1 立即下载

    意见
    反馈

    返回
    顶部