Skip to content Navigation MenuSign inAppearance settingsPlatformAI CODE CREATIONGitHub CopilotWrite better code with AIGitHub Copilot appDirect agents from issue to mergeMCP RegistryIntegrate external toolsDEVELOPER WORKFLOWSActionsAutomate any workflowCodespacesInstant dev environmentsIssuesPlan and track workCode ReviewManage code changesCode QualityEnforce quality at mergeAPPLICATION SECURITYGitHub Advanced SecurityFind and fix vulnerabilitiesCode securitySecure your code as you buildSecret protectionStop leaks before they startEXPLOREWhy GitHubDocumentationBlogChangelogMarketplaceView all featuresSolutionsBY COMPANY SIZEEnterprisesSmall and medium teamsStartupsNonprofitsBY USE CASEApp ModernizationDevSecOpsDevOpsCI/CDView all use casesBY INDUSTRYHealthcareFinancial servicesManufacturingGovernmentView all industriesView all solutionsResourcesEXPLORE BY TOPICAISoftware DevelopmentDevOpsSecurityView all topicsEXPLORE BY TYPECustomer storiesEvents & webinarsEbooks & reportsBusiness insightsGitHub SkillsSUPPORT & SERVICESDocumentationCustomer supportCommunity forumTrust centerPartnersView all resourcesOpen SourceCOMMUNITYGitHub SponsorsFund open source developersPROGRAMSSecurity LabMaintainer CommunityGitHub StarsArchive ProgramREPOSITORIESTopicsTrendingCollectionsEnterpriseENTERPRISE SOLUTIONSEnterprise platformAI-powered developer platformAVAILABLE ADD-ONSGitHub Advanced SecurityEnterprise-grade security featuresCopilot for BusinessEnterprise-grade AI featuresPremium SupportEnterprise-grade 24/7 supportPricingSearch/Sign inSign upAppearance settings You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} PatrickJSangular-websocketRepository navigationCodeIssues57Β (57)Pull requests7Β (7)ActionsProjectsWikiSecurity and qualityInsightsMore items How do I auto reconnect?Β #100New issueCopy linkNew issueCopy linkOpenOpenHow do I auto reconnect?#100Copy linkDescriptionghostI came from ng-websocket (https://github.com/wilk/ng-websocket) in which you can simply do: var ws = $websocket.$new('ws://localhost:12345', true); The true makes it auto-reconnect when there's a failure. How can I create the same in this project?Reactions are currently unavailableActivitylmmfranco commented on Apr 11, 2017 lmmfrancoLast edited by lmmfrancoMore actionsIt is not documented, but reading the source code we can see this bit: this.scope = options && options.scope || $rootScope; this.rootScopeFailover = options && options.rootScopeFailover && true; this.useApplyAsync = options && options.useApplyAsync || false; this.initialTimeout = options && options.initialTimeout || 500; // 500ms this.maxTimeout = options && options.maxTimeout || 5 * 60 * 1000; // 5 minutes this.reconnectIfNotNormalClose = options && options.reconnectIfNotNormalClose || false; this.binaryType = options && options.binaryType || 'blob'; So yeah, just call it like this: $websocket("ws://localhost:8337", null, { reconnectIfNotNormalClose: true });πReact with π4Reacted by Tomasz Waszczyk, Marcus, VAluvila and hamedtyTomaszWaszczyk commented on Mar 1, 2018 TomaszWaszczykMore actionsThanks!!VAluvila commented on Jan 24, 2019 VAluvilaMore actions It is not documented, but reading the source code we can see this bit: this.scope = options && options.scope || $rootScope; this.rootScopeFailover = options && options.rootScopeFailover && true; this.useApplyAsync = options && options.useApplyAsync || false; this.initialTimeout = options && options.initialTimeout || 500; // 500ms this.maxTimeout = options && options.maxTimeout || 5 * 60 * 1000; // 5 minutes this.reconnectIfNotNormalClose = options && options.reconnectIfNotNormalClose || false; this.binaryType = options && options.binaryType || 'blob'; So yeah, just call it like this: $websocket("ws://localhost:8337", null, { reconnectIfNotNormalClose: true }); Great! You saved my day dear ;-)πReact with π1Reacted by lmmfrancoSign up for free to join this conversation on GitHub. Already have an account? Sign in to commentMetadataMetadataAssigneesNo one assignedLabelsNo labelsNo labelsProjectsNo projectsMilestoneNo milestoneRelationshipsNone yetDevelopmentNo branches or pull requestsIssue actionsOpen in GitHub Copilot app You canβt perform that action at this time.
Activity
lmmfranco commentedon Apr 11, 2017
It is not documented, but reading the source code we can see this bit:
So yeah, just call it like this:
TomaszWaszczyk commentedon Mar 1, 2018
Thanks!!
VAluvila commentedon Jan 24, 2019
Great! You saved my day dear ;-)