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

Syncfusion.ASP.NET SignalR.2013.pdf

Syncfusion.ASP.NET SignalR.2013…

上传者: firmwu 2013-03-30 评分1 评论0 下载54 收藏0 阅读量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

职业精品

(汽车)产品营销策划书范文.doc

HH牙膏营销方案策划书.doc

加班管理人力资源考勤管理系统方案.doc

物品采购管理制度-正式.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 立即下载

意见
反馈

返回
顶部