{"id":18204477,"url":"https://github.com/3p3r/websocket-redirect-shim","last_synced_at":"2026-04-28T18:34:17.655Z","repository":{"id":73994454,"uuid":"449005676","full_name":"3p3r/websocket-redirect-shim","owner":"3p3r","description":"a shim (patch) to support WebSocket redirect requests in browsers","archived":false,"fork":false,"pushed_at":"2022-02-17T04:32:46.000Z","size":166,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T18:53:53.274Z","etag":null,"topics":["es5-javascript","es6-javascript","redirect","shim","socket-io","websocket"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/3p3r.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2022-01-17T18:29:09.000Z","updated_at":"2024-04-05T22:11:32.000Z","dependencies_parsed_at":"2023-12-30T03:30:39.900Z","dependency_job_id":null,"html_url":"https://github.com/3p3r/websocket-redirect-shim","commit_stats":{"total_commits":8,"total_committers":2,"mean_commits":4.0,"dds":0.125,"last_synced_commit":"94235526dcf9862dfc5a8b24787084f291987100"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/3p3r/websocket-redirect-shim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3p3r%2Fwebsocket-redirect-shim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3p3r%2Fwebsocket-redirect-shim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3p3r%2Fwebsocket-redirect-shim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3p3r%2Fwebsocket-redirect-shim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/3p3r","download_url":"https://codeload.github.com/3p3r/websocket-redirect-shim/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3p3r%2Fwebsocket-redirect-shim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32394465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T14:34:11.604Z","status":"ssl_error","status_checked_at":"2026-04-28T14:32:37.009Z","response_time":56,"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":["es5-javascript","es6-javascript","redirect","shim","socket-io","websocket"],"created_at":"2024-11-03T11:04:28.119Z","updated_at":"2026-04-28T18:34:17.625Z","avatar_url":"https://github.com/3p3r.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# websocket-redirect-shim\n\na shim (patch) to support WebSocket redirect requests in browsers\n\n## prerequisite\n\nthis shim needs a server-side helper to resolve the eventual WebSocket address for it. the server side helper is also\nwritten in NodeJS and requires the [serverless framework](https://www.serverless.com/) to deploy into AWS.\n\ndeploy with:\n\n```bash\nserverless deploy\n```\n\nexample output:\n\n```bash\n$ serverless deploy\nServerless: Packaging service...\nServerless: Excluding development dependencies...\nServerless: Ensuring that deployment bucket exists\nServerless: Uploading CloudFormation file to S3...\nServerless: Uploading artifacts...\nServerless: Uploading service websocket-redirect-shim.zip file to S3 (9.32 MB)...\nServerless: Validating template...\nServerless: Updating Stack...\nServerless: Checking Stack update progress...\n..............\nServerless: Stack update finished...\nService Information\nservice: websocket-redirect-shim\nstage: dev\nregion: us-east-1\nstack: websocket-redirect-shim-dev\nresources: 12\napi keys:\n  None\nendpoints:\n  GET - \u003cendpoint URL\u003e\nfunctions:\n  resolve: websocket-redirect-shim-dev-resolve\nlayers:\n  None\n```\n\n`\u003cendpoint URL\u003e` is where you'll find the shim's JavaScript and the same endpoint can resolve an address after redirects\nfor you if you pass it a `?url=` query string. Both HTTP and WS URL schemes are supported. You do not need to directly\nwork with the resolver. The patch internally handles that.\n\nthis server helper is necessary due to the fact that currently it's impossible to detect AND follow a URL manually in\nall major browsers. both the `fetch()` api and `XMLHttpRequest` object cannot do that and gymnastics with `iframe`s do\nnot interest me. in a browser redirects are handled internally and transparently and are not exposed to end user.\n\n## usage\n\nJust include the patch somewhere before you create a `WebSocket` in a browser. As soon as you create the socket, a GET\nrequest will be made to your provided websocket endpoint. If response comes back with a 3xx status, resolver will follow\nit until status no longer sets to 3xx and your `WebSocket` instance will get connected to the last redirect in the chain\n\n## polyfilled vs lean\n\nAfter you `npm install` in this repo, you get a polyfilled version (`websocket-redirect-shim.polyfill.min.js`) and a\nlean version (`websocket-redirect-shim.min.js`). Use the lean version if you are sure about the browser environment you\nneed this patch in. Your environment needs to support these features:\n\n- Async/Await\n- WebSocket\n- Reflect\n- Proxy\n\n## `window.WEBSOCKET_REDIRECT_RESOLVER`\n\nThe patch looks for the resolver endpoint through this variable. If you use the patch through the helper Lambda, the\npatch script file will have this defined at its top.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3p3r%2Fwebsocket-redirect-shim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F3p3r%2Fwebsocket-redirect-shim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3p3r%2Fwebsocket-redirect-shim/lists"}