{"id":17356898,"url":"https://github.com/j8r/crystal-byte-protocol","last_synced_at":"2026-03-11T00:32:50.498Z","repository":{"id":152029266,"uuid":"328778441","full_name":"j8r/crystal-byte-protocol","owner":"j8r","description":"A byte protocol for Crystal","archived":false,"fork":false,"pushed_at":"2023-02-14T18:50:08.000Z","size":33,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T00:41:27.438Z","etag":null,"topics":["bytes","crystal-lang","protocol","websocket"],"latest_commit_sha":null,"homepage":"","language":"Crystal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/j8r.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-01-11T20:05:30.000Z","updated_at":"2023-02-16T11:25:06.000Z","dependencies_parsed_at":"2023-09-13T22:08:56.782Z","dependency_job_id":null,"html_url":"https://github.com/j8r/crystal-byte-protocol","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/j8r/crystal-byte-protocol","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j8r%2Fcrystal-byte-protocol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j8r%2Fcrystal-byte-protocol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j8r%2Fcrystal-byte-protocol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j8r%2Fcrystal-byte-protocol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/j8r","download_url":"https://codeload.github.com/j8r/crystal-byte-protocol/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j8r%2Fcrystal-byte-protocol/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30363925,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T21:41:54.280Z","status":"ssl_error","status_checked_at":"2026-03-10T21:40:59.357Z","response_time":106,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["bytes","crystal-lang","protocol","websocket"],"created_at":"2024-10-15T18:59:10.778Z","updated_at":"2026-03-11T00:32:50.493Z","avatar_url":"https://github.com/j8r.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Crystal Byte Protocol\n\n[![CI](https://github.com/j8r/crystal-byte-protocol/workflows/CI/badge.svg)](https://github.com/j8r/crystal-byte-protocol/actions?query=workflow%3ACI)\n[![Documentation](https://github.com/j8r/crystal-byte-protocol/workflows/Documentation/badge.svg)](https://j8r.github.io/crystal-byte-protocol)\n[![ISC](https://img.shields.io/badge/License-ISC-blue.svg?style=flat-square)](https://en.wikipedia.org/wiki/ISC_license)\n\n## Installation\n\nAdd the dependency to your `shard.yml`:\n\n```yaml\ndependencies:\n  crystal-byte-protocol:\n    github: j8r/crystal-byte-protocol\n```\n\n## Documentation\n\nhttps://j8r.github.io/crystal-byte-protocol\n\n## Usage\n\nSee the [specs](./specs) to have concrete examples.\n\n### Generate JS protocol messages\n\nIn a `bin/gen-js-protocol-messages.cr` file:\n\n```cr\nrequire \"crystal-byte-protocol/crystal_to_js_byte_format\"\nrequire \"../src/protocol.cr\"\n\ndir = Path.new \"../web-client/js/protocol\"\n\nCrystalByteProtocol::CrystalToJS.convert_to_file(\n  dir / \"Client.js\",\n  MyApp::Protocol::Client\n)\n\nCrystalByteProtocol::CrystalToJS.convert_to_file(\n  dir / \"Server.js\",\n  MyApp::Protocol::Server\n)\n```\n\n### Use protocol messages in JS with WebSocket\n\nBe sure to set the WebSocket binaryType to `\"arraybuffer\"`\n\n```js\nconst socket = new WebSocket(address)\nsocket.binaryType = \"arraybuffer\"\n\nthis.socket.onmessage = (event) =\u003e {\n  const message = Server.deserialize(new ByteDecoder(event.data))\n  console.log(message)\n}\n\nconst object = new Client.MyObject\nsocket.send(Client.serialize(new ByteEncoder(), object))\n```\n\n## License\n\nCopyright (c) 2021-2023 Julien Reichardt - ISC License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj8r%2Fcrystal-byte-protocol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fj8r%2Fcrystal-byte-protocol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj8r%2Fcrystal-byte-protocol/lists"}