{"id":17489683,"url":"https://github.com/melishev/wsgo","last_synced_at":"2025-04-22T18:27:15.568Z","repository":{"id":220685816,"uuid":"752301765","full_name":"melishev/wsgo","owner":"melishev","description":"WebSocket client for the browser. Simplifying development and debugging","archived":false,"fork":false,"pushed_at":"2024-06-18T22:29:36.000Z","size":377,"stargazers_count":5,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-16T22:56:22.786Z","etag":null,"topics":["real-time","rfc-6455","websocket"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/melishev.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":"2024-02-03T15:39:19.000Z","updated_at":"2025-02-22T17:58:37.000Z","dependencies_parsed_at":"2025-03-15T09:41:04.385Z","dependency_job_id":null,"html_url":"https://github.com/melishev/wsgo","commit_stats":null,"previous_names":["melishev/vite-project"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melishev%2Fwsgo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melishev%2Fwsgo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melishev%2Fwsgo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melishev%2Fwsgo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/melishev","download_url":"https://codeload.github.com/melishev/wsgo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250296537,"owners_count":21407039,"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":["real-time","rfc-6455","websocket"],"created_at":"2024-10-19T05:43:47.906Z","updated_at":"2025-04-22T18:27:15.521Z","avatar_url":"https://github.com/melishev.png","language":"TypeScript","funding_links":[],"categories":["Browser libraries"],"sub_categories":["Protocols and APIs"],"readme":"\u003ch1 align=\"center\"\u003eWSGO\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003eWebSocket client for the browser. Simplifying development and debugging\u003c/p\u003e\n\n\u003e [!NOTE]\n\u003e Please lock the version of the package. This library is not stable yet and may have some behavioral differences depending on the version.\n\n### What is WSGO?\n\nThe WSGO library acts as an abstraction on top of a pure WebSocket connection. Think of it as:\n\n- Socket.io, only without being tied to your server implementation\n- Axios, just for WebSocket communication\n\nWSGO is designed to standardize communication between client and server through an explicit and common communication format\n\n### Getting Started\n\nTo install the library in your project:\n\n```\nnpm i wsgo\n```\n\nThen import WSGO into your code to create a connection to the server with the default settings:\n\n```js\nimport WSGO from 'wsgo'\n\nconst wsgo = WSGO('wss://echo.websocket.org')\n```\n\n### Options\n\n#### debugging\n\n\u003e Allows you to enable debugging mode when working with events. Logs outgoing and incoming events more informative than default browser developer tools\n\n- type: boolean\n- default: false\n\n#### immediate\n\n\u003e Whether to connect to the server automatically when WSGO is initialized. If set to false, call the `open` method yourself when you are ready\n\n- type: boolean\n- default: true\n\n#### heartbeat\n\n\u003e Implements the basic ping-pong mechanism. If there is no response from the server, closes the connection\n\n- type: boolean\n- default: true\n\n### Examples\n\nCreate a WebSocket connection:\n\n```js\nimport WSGO from 'wsgo'\n\nconst wsgo = WSGO('wss://echo.websocket.org')\n```\n\nOpen the connection manually:\n\n```js\nimport WSGO from 'wsgo'\n\nconst wsgo = WSGO('wss://echo.websocket.org', {\n  immediate: false,\n})\n\nwsgo.open()\n```\n\nRegister an event listener:\n\n```js\nimport WSGO from 'wsgo'\n\nconst wsgo = WSGO('wss://echo.websocket.org')\n\nwsgo.subscribe('my-event', (e) =\u003e {\n  console.log(e)\n})\n```\n\nSend the event to the server:\n\n```js\nimport WSGO from 'wsgo'\n\nconst wsgo = WSGO('wss://echo.websocket.org')\n\nwsgo.send('my-event', { text: 'Hello world!' })\n```\n\nGet the original and unmodified Websocket instance:\n\n```js\nimport WSGO from 'wsgo'\n\nconst wsgo = WSGO('wss://echo.websocket.org')\n\nconst status = wsgo.ws.readyState\n```\n\nClose the connection:\n\n```js\nimport WSGO from 'wsgo'\n\nconst wsgo = WSGO('wss://echo.websocket.org')\n\nwsgo.close()\n```\n\n### Feedback\n\nWSGO is designed to create a convenient and easy way to interact with WebSocket. We would love to get your ideas on how to make it even better.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelishev%2Fwsgo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmelishev%2Fwsgo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelishev%2Fwsgo/lists"}