{"id":21041431,"url":"https://github.com/pladaria/html5-websocket","last_synced_at":"2025-05-15T16:33:53.779Z","repository":{"id":57267908,"uuid":"53811264","full_name":"pladaria/html5-websocket","owner":"pladaria","description":"HTML5 WebSocket for node.js","archived":false,"fork":false,"pushed_at":"2018-09-30T17:47:42.000Z","size":55,"stargazers_count":8,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-02-27T19:04:03.300Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/pladaria.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-13T22:33:52.000Z","updated_at":"2020-04-23T17:18:19.000Z","dependencies_parsed_at":"2022-09-02T02:50:09.773Z","dependency_job_id":null,"html_url":"https://github.com/pladaria/html5-websocket","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pladaria%2Fhtml5-websocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pladaria%2Fhtml5-websocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pladaria%2Fhtml5-websocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pladaria%2Fhtml5-websocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pladaria","download_url":"https://codeload.github.com/pladaria/html5-websocket/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225365645,"owners_count":17462964,"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":[],"created_at":"2024-11-19T13:52:09.864Z","updated_at":"2024-11-19T13:52:10.529Z","avatar_url":"https://github.com/pladaria.png","language":"JavaScript","readme":"# DEPRECATED\n\n:warning: **Consider this library as deprecated. It was created to expose `ws` with a `WebSocket` interface. This is no longer needed because latest versions of `ws` already implement this interface.**\n\n---\n\n# html5-websocket\n\nThis module implements the standard [HTML5 WebSocket API](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) as a thin layer over the great [ws](https://www.npmjs.com/package/ws) library.\n\nThe motivation behind this module is to be able to write WebSocket based libraries that will run without changes in Node.js, Browsers or React Native apps.\n\n## Install\n\n```bash\nnpm install --save html5-websocket\n```\n\n## Usage\n\nThe API is the same as the standard HTML5 Socket API so nothing new here...\n\n```javascript\nconst WebSocket = require('html5-websocket');\n\nconst ws = new WebSocket('ws://html5rocks.websocket.org/echo');\n\nws.onopen = function () {\n    ws.send('Hello!');\n};\n\nws.onmessage = function (e) {\n    console.log(e.data);\n};\n\nws.onerror = function (error) {\n    console.log('Fail:', error);\n};\n```\n\nYou can also use the DOM Level 2 Event Model\n\n```javascript\nconst handleMessage = function (e) {\n    console.log(e.data);\n};\n\n// add listener\nws.addEventListener('message', handleMessage);\n\n// remove listener\nws.removeEventListener('message', handleMessage);\n```\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpladaria%2Fhtml5-websocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpladaria%2Fhtml5-websocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpladaria%2Fhtml5-websocket/lists"}