{"id":17349232,"url":"https://github.com/co2-git/maeva-sockets","last_synced_at":"2025-03-27T11:44:27.746Z","repository":{"id":68258966,"uuid":"73656981","full_name":"co2-git/maeva-sockets","owner":"co2-git","description":"Web Sockets API to connect any database. Client (web + node) + server","archived":false,"fork":false,"pushed_at":"2017-12-23T16:08:34.000Z","size":108,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-05T14:17:26.870Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/co2-git.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2016-11-14T01:52:55.000Z","updated_at":"2017-11-30T04:04:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"d5b4e32d-2360-454d-991d-dea5d8afd2df","html_url":"https://github.com/co2-git/maeva-sockets","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"6a6f29bdb21e9bbd0f704d8292a187c30f74aee6"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/co2-git%2Fmaeva-sockets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/co2-git%2Fmaeva-sockets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/co2-git%2Fmaeva-sockets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/co2-git%2Fmaeva-sockets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/co2-git","download_url":"https://codeload.github.com/co2-git/maeva-sockets/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245841692,"owners_count":20681184,"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-15T16:55:07.455Z","updated_at":"2025-03-27T11:44:27.726Z","avatar_url":"https://github.com/co2-git.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"maeva-sockets\n===\n\nFramework to set up a web sockets server that can transport database queries and deliver them to clients.\n\n`maeva-sockets` relies on [maeva](https://github.com/co2-git/maeva).\n\n# Why\n\nEven when you have a database server set up, you need a relay server (HTTP or Web Sockets) so that your client can connect to the database server. `maeva-sockets` gives a framework so you can easily create a server your client can talk to to transport database queries.\n\n# Server\n\nIt is easy to set up a server. Let's say you want to set up a server that can transport queries to a MongoDB server:\n\n```javascript\nimport {Server} from 'maeva-sockets';\nimport mongodb from 'maeva-mongodb';\n\nconst port = 7000;\nconst mongodbUrl = 'mongodb://@localhost:27019';\nconst drivers = [\n  {\n    name: 'mongodb',\n    connect: () =\u003e mongodb(mongodbUrl),\n  }\n];\n\n// Start server\nexport default new Server(port, drivers)\n  .on('error', (error) =\u003e {})\n  .on('listening', (conn) =\u003e {\n    console.log(`listening on port ${conn.port}`);\n  });\n```\n\n# Client\n\n```javascript\nimport maeva, {Model, type} from 'maeva';\nimport sockets from 'maeva-sockets';\n\n// Define your maeva model\nclass User extends Model {\n  static schema = {email: type(String)};\n}\n\n// Connect to sockets server\nconst serverURL = 'ws://localhost:7000';\n\nmaeva.connect(sockets(serverURL));\n\n// Now you can call any queries\nUser.find().then(users =\u003e console.log(users.toJSON()));\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fco2-git%2Fmaeva-sockets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fco2-git%2Fmaeva-sockets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fco2-git%2Fmaeva-sockets/lists"}