{"id":15655089,"url":"https://github.com/torxed/slimwebsocket","last_synced_at":"2025-03-24T01:44:27.870Z","repository":{"id":55370901,"uuid":"213927454","full_name":"Torxed/slimWebSocket","owner":"Torxed","description":"A wrapper around WebSocket for JavaScript","archived":false,"fork":false,"pushed_at":"2021-01-07T07:21:38.000Z","size":50,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-25T17:19:28.742Z","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":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Torxed.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}},"created_at":"2019-10-09T13:33:51.000Z","updated_at":"2021-01-07T07:21:41.000Z","dependencies_parsed_at":"2022-08-14T22:41:58.681Z","dependency_job_id":null,"html_url":"https://github.com/Torxed/slimWebSocket","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Torxed%2FslimWebSocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Torxed%2FslimWebSocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Torxed%2FslimWebSocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Torxed%2FslimWebSocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Torxed","download_url":"https://codeload.github.com/Torxed/slimWebSocket/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245195908,"owners_count":20575936,"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-10-03T12:56:02.741Z","updated_at":"2025-03-24T01:44:27.847Z","avatar_url":"https://github.com/Torxed.png","language":"JavaScript","readme":"# slimWebSocket\nA wrapper around WebSocket for JavaScript\n\n# Example usecases\n\n```html\n\u003cscript\u003e\n\tlet socket = new slimWebSocket('wss://obtain.life');\n\t\n\tsocket.subscribe('certain_key', (json) =\u003e {\n\t\tconsole.log('Got data containing certain_key:', json);\n\t})\n\tsocket.send({\"test\" : \"ping\"});\n\u003c/script\u003e\n```\n\n# Features\n\n * Auto-reconnect\n * Simple message queue (with limited re-send error handling)\n * Type parsing attempt if you're sending a non-string\n * Hook in `socket.socket.addEventListener('message', function(data) {} )` if you need to replace event hooks.\n\n# Installation\n\n```html\n\u003cscript type=\"text/javascript\"\u003e\n\tlet socket = null; // Create a global socket element, initate it with `new slimWebSocket();` later\n\t\n\t// Loading JavaScript from a cross-site resource is blocked.\n\t// But there's nothing stopping us from downloading the script\n\t// as a text-blob and placing it within the \u003cscript\u003e \u003c/ script\u003e tags,\n\t// which causes the browser to parse it, but not as a forrain object.\n\t//\n\t// #LoadingScriptsFromGithub\n\n\tlet xhr = new XMLHttpRequest();\n\txhr.open(\"GET\", 'https://raw.githubusercontent.com/Torxed/slimWebSocket/master/slimWebSocket.js', true);\n\txhr.onreadystatechange = function() {\n\t\tif (this.readyState === XMLHttpRequest.DONE \u0026\u0026 this.status === 200) {\n\t\t\tlet script = document.createElement('script');\n\t\t\tscript.type = 'text/javascript';\n\t\t\tscript.innerHTML = this.responseText;\n\t\t\tdocument.head.appendChild(script);\n\n\t\t\tsocket = new slimWebSocket();\n\t\t}\n\t}\n\txhr.send();\n\u003c/script\u003e\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftorxed%2Fslimwebsocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftorxed%2Fslimwebsocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftorxed%2Fslimwebsocket/lists"}