{"id":13527151,"url":"https://github.com/heineiuo/isomorphic-ws","last_synced_at":"2025-05-15T02:06:20.334Z","repository":{"id":38051342,"uuid":"105848858","full_name":"heineiuo/isomorphic-ws","owner":"heineiuo","description":"Isomorphic implementation of WebSocket (https://www.npmjs.com/package/ws)","archived":false,"fork":false,"pushed_at":"2023-06-20T06:12:50.000Z","size":114,"stargazers_count":407,"open_issues_count":12,"forks_count":45,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-30T12:42:35.254Z","etag":null,"topics":["browser","isomorphic","nodejs","websocket","websockets","ws"],"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/heineiuo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2017-10-05T04:22:24.000Z","updated_at":"2025-03-31T07:15:09.000Z","dependencies_parsed_at":"2024-06-18T12:26:23.648Z","dependency_job_id":null,"html_url":"https://github.com/heineiuo/isomorphic-ws","commit_stats":{"total_commits":26,"total_committers":9,"mean_commits":2.888888888888889,"dds":"0.42307692307692313","last_synced_commit":"34168022a7458a96ab5c12747eca0eb1c71b22cb"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heineiuo%2Fisomorphic-ws","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heineiuo%2Fisomorphic-ws/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heineiuo%2Fisomorphic-ws/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heineiuo%2Fisomorphic-ws/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heineiuo","download_url":"https://codeload.github.com/heineiuo/isomorphic-ws/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252968118,"owners_count":21833251,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["browser","isomorphic","nodejs","websocket","websockets","ws"],"created_at":"2024-08-01T06:01:42.126Z","updated_at":"2025-05-15T02:06:20.317Z","avatar_url":"https://github.com/heineiuo.png","language":"JavaScript","funding_links":[],"categories":["Repository","JavaScript"],"sub_categories":["Real-time"],"readme":"# isomorphic-ws\n\nIsomorphic implementation of WebSocket.\n\nIt uses:\n- [ws](https://github.com/websockets/ws) on Node\n- [global.WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) in browsers\n\n## Limitations\n\nBefore using this module you should know that\n[`ws`](https://github.com/websockets/ws/blob/master/doc/ws.md#class-websocket)\nis not perfectly API compatible with\n[WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket),\nyou should always test your code against both Node and browsers.\n\nSome major differences:\n\n- no `Server` implementation in browsers\n- no support for the constructor\n  [`options`](https://github.com/websockets/ws/blob/master/doc/ws.md#new-websocketaddress-protocols-options)\n  argument in browsers\n\n## Usage\n\nYou need to install both this package and [ws](https://github.com/websockets/ws):\n\n```\n\u003e npm i isomorphic-ws ws\n```\n\nThen just require this package:\n\n```js\nconst WebSocket = require('isomorphic-ws');\n\nconst ws = new WebSocket('wss://websocket-echo.com/');\n\nws.onopen = function open() {\n  console.log('connected');\n  ws.send(Date.now());\n};\n\nws.onclose = function close() {\n  console.log('disconnected');\n};\n\nws.onmessage = function incoming(data) {\n  console.log(`Roundtrip time: ${Date.now() - data.data} ms`);\n\n  setTimeout(function timeout() {\n    ws.send(Date.now());\n  }, 500);\n};\n```\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheineiuo%2Fisomorphic-ws","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheineiuo%2Fisomorphic-ws","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheineiuo%2Fisomorphic-ws/lists"}