{"id":25488535,"url":"https://github.com/kocisov/adventure","last_synced_at":"2025-11-08T06:30:38.498Z","repository":{"id":135594206,"uuid":"92096831","full_name":"kocisov/adventure","owner":"kocisov","description":"Simple WebSocket Client","archived":false,"fork":false,"pushed_at":"2017-05-28T14:04:50.000Z","size":30,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-12T08:16:34.647Z","etag":null,"topics":["adventure","client","reconnect","simple","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/kocisov.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}},"created_at":"2017-05-22T20:31:49.000Z","updated_at":"2020-09-17T12:20:04.000Z","dependencies_parsed_at":"2023-07-08T15:15:17.601Z","dependency_job_id":null,"html_url":"https://github.com/kocisov/adventure","commit_stats":null,"previous_names":["braind/adventure"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kocisov%2Fadventure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kocisov%2Fadventure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kocisov%2Fadventure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kocisov%2Fadventure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kocisov","download_url":"https://codeload.github.com/kocisov/adventure/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239550296,"owners_count":19657540,"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":["adventure","client","reconnect","simple","websocket"],"created_at":"2025-02-18T20:52:47.246Z","updated_at":"2025-11-08T06:30:38.452Z","avatar_url":"https://github.com/kocisov.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Adventure [![npm](https://img.shields.io/npm/v/@braind/adventure.svg)](http://npmjs.com/package/@braind/adventure) [![Code Climate](https://codeclimate.com/github/braind/adventure/badges/gpa.svg)](https://codeclimate.com/github/braind/adventure) [![gzip size](http://img.badgesize.io/https://unpkg.com/@braind/adventure/lib/index.js?compression=gzip\u0026label=gzip%20size)]()\n\u003e Simple WebSocket Client\n\n## Features\n- Reconnect implemented\n- Handle Errors and Messages + Redux with your simple functions\n\n## Installation\n```bash\n# yarn\nyarn add @braind/adventure\n\n# npm\nnpm install @braind/adventure --save\n```\n\n## Usage\n```js\nimport adventureClient from '@braind/adventure';\nimport store from './redux/store';\n\nconst adventure = new adventureClient({\n  debug: true,\n  handleMessage,\n  maxReconnectAttempts: 5,\n  reconnect: true,\n  reconnectInterval: 5000,\n  reduxDispatcher,\n  responseType: 'json',\n  url: 'ws://localhost:3000'\n});\n\nfunction handleMessage(message) {\n  console.log(message);\n\n  if (message === 'Ping' || message.type === 'Ping') {\n    adventure.send('Pong');\n  }\n}\n\nfunction reduxDispatcher(message) {\n  const { type, data: payload } = message;\n\n  switch(type) {\n    case 'RECEIVED_INFO':\n      store.dispatch({\n        type: 'RECEIVED_INFO',\n        payload\n      });\n\n    default:\n      console.log('Received unspecified action type');\n  }\n}\n\nconst currentSocketNumber = adventure.socketNumber();\nconst nextSocketNumber = adventure.nextSocketNumber();\nconst lastSocketNumber = adventure.lastSocketNumber();\n```\n\n## API\n\n#### adventureClient([opts])\nCreates Adventure Client\n\n##### Options\n- debug: boolean - default is false,\n- handleError: function - optional,\n- handleMessage: function - optional,\n- maxReconnectAttempts: number - default is 3,\n- reconnect: boolean - default is false,\n- reconnectInterval: number - default is 5000ms,\n- reduxDispatcher: function - optional,\n- responseType: [json, text] - default is json,\n- url: string -\u003e 'ws://localhost:3000' - required\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkocisov%2Fadventure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkocisov%2Fadventure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkocisov%2Fadventure/lists"}