{"id":16024568,"url":"https://github.com/stephenlb/support-agent-muit-tab","last_synced_at":"2026-01-27T05:33:13.354Z","repository":{"id":66632429,"uuid":"406175772","full_name":"stephenlb/support-agent-muit-tab","owner":"stephenlb","description":"Example using PubNub Presence for Support Agent Tracking across Multiple Tabs/Windows","archived":false,"fork":false,"pushed_at":"2021-09-14T01:34:58.000Z","size":2649,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-02T12:16:15.633Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stephenlb.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-14T00:53:56.000Z","updated_at":"2021-09-14T01:35:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"5c00360b-01f7-4882-9731-0775cc6b2e0a","html_url":"https://github.com/stephenlb/support-agent-muit-tab","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/stephenlb/support-agent-muit-tab","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenlb%2Fsupport-agent-muit-tab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenlb%2Fsupport-agent-muit-tab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenlb%2Fsupport-agent-muit-tab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenlb%2Fsupport-agent-muit-tab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stephenlb","download_url":"https://codeload.github.com/stephenlb/support-agent-muit-tab/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenlb%2Fsupport-agent-muit-tab/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28804018,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T03:44:14.111Z","status":"ssl_error","status_checked_at":"2026-01-27T03:43:33.507Z","response_time":168,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-08T19:21:52.041Z","updated_at":"2026-01-27T05:33:13.312Z","avatar_url":"https://github.com/stephenlb.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Support Agent Presence Tracking\n\nTwo options are demonstrated.\n`one.html` and `two.html`.\nThe example code shows the SDK settings needed to accomlish each option.\n\n## Presence Tuning/Configuration for Support Agent Tracking\n\n\u003e **tl;dr**\n\u003e **Option one is a best practice approach.**\n\n### Option One\n\n![support agent presence multi tab](media/support-agent-presence-multi-tab.gif)\n\n\u003e This option also is a good fit for TCP-FIN tracking.\n\u003e When a TCP connection is closed, this can be counted as a presence `leave` event.\n\u003e The example also offers a\n\u003e `window.addEventListener('beforeunload', event =\u003e { pubnub.unsubscribeAll(); } );`\n\u003e browser event.\n\u003e Both options work in practice.\n\nAn \"agent-channel\" is a channel the agent subscribes to.\nEach tab has an \"agent-uuid\" with a suffix of a \"windowID/tabID\".\nThe webhook is registered to \"active\" and \"inactive\".\nWhen the agent opens their first tab, the \"active\" webhook fires.\nSubsequent tabs being opened will not fire any events.\nOnce all tabs are closed, the \"inactive\" webhook fires.\nThe occupancy count represents the number of Tabs open for that agent's channel.\nNo special settings are needed, though we can tune/tweak behavior as needed.\nThis option has the most value and is more inline with stock presence capability.\nThis is a good design pattern that can be used to\naccomplish the support chat agent business requirements.\n\n### Option Two\n\nUsing special JS SDK settings and special PubNub Config settings,\nwe can track an Agent's activity across all tabs, using a single UUID.\nAfter inactivity of 300 seconds (tunable),\na timeout event is fired, marking the agent has gone offline.\nThis option is the simplest,\nthough requires specific SDK and PubNub Config settings.\nIt's the simplest as it requires little consideration.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephenlb%2Fsupport-agent-muit-tab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstephenlb%2Fsupport-agent-muit-tab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephenlb%2Fsupport-agent-muit-tab/lists"}