{"id":17288248,"url":"https://github.com/yallie/jsonservices","last_synced_at":"2025-10-05T08:25:27.226Z","repository":{"id":35030150,"uuid":"158864854","full_name":"yallie/JsonServices","owner":"yallie","description":"Simple JSON-RPC service framework for C# and TypeScript","archived":false,"fork":false,"pushed_at":"2024-09-11T12:25:46.000Z","size":1236,"stargazers_count":16,"open_issues_count":8,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-14T11:07:42.747Z","etag":null,"topics":["fleck","json","messages","netmq","rpc","secure-remote-password","security","srp","srp-6a","typescript","websockets","zeromq"],"latest_commit_sha":null,"homepage":null,"language":"C#","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/yallie.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}},"created_at":"2018-11-23T18:11:23.000Z","updated_at":"2025-04-09T10:13:36.000Z","dependencies_parsed_at":"2023-02-15T13:16:05.005Z","dependency_job_id":null,"html_url":"https://github.com/yallie/JsonServices","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yallie%2FJsonServices","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yallie%2FJsonServices/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yallie%2FJsonServices/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yallie%2FJsonServices/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yallie","download_url":"https://codeload.github.com/yallie/JsonServices/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248868769,"owners_count":21174758,"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":["fleck","json","messages","netmq","rpc","secure-remote-password","security","srp","srp-6a","typescript","websockets","zeromq"],"created_at":"2024-10-15T10:26:37.129Z","updated_at":"2025-10-05T08:25:22.185Z","avatar_url":"https://github.com/yallie.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# JsonServices\n\n[![.NET](https://github.com/yallie/JsonServices/actions/workflows/dotnet.yml/badge.svg)](https://github.com/yallie/JsonServices/actions/workflows/dotnet.yml)\n[![Appveyor build status](https://ci.appveyor.com/api/projects/status/l8sntux7xbx53rk6?svg=true)](https://ci.appveyor.com/project/yallie/jsonservices)\n[![Tests](https://img.shields.io/appveyor/tests/yallie/JsonServices.svg)](https://ci.appveyor.com/project/yallie/JsonServices/build/tests)\n[![Code coverage](https://codecov.io/gh/yallie/JsonServices/branch/master/graph/badge.svg)](https://codecov.io/gh/yallie/JsonServices)\n[![Code quality](https://img.shields.io/codefactor/grade/github/yallie/JsonServices)](https://www.codefactor.io/repository/github/yallie/jsonservices)\n[![Nuget](https://img.shields.io/nuget/vpre/JsonServices.svg)](https://www.nuget.org/packages/JsonServices/)\n\nThis is a simple library for message-based services running on top of the  \nWebSockets or ZeroMQ connection and based on JSON-RPC 2.0 Specification:  \n\nhttps://www.jsonrpc.org/specification\n\nThe project consists of C# server, C# client and TypeScript client.  \nNote that TypeScript client supports only web socket connections.\n\n## Message-based RPC\n\nThe communication is based on message names, not service and/or method names  \nlike normal RPC. The idea is inspired by ServiceStack architecture.\n\nC# server code example:\n\n```c#\n// request message\npublic class GetUser : IReturn\u003cGetUserResponse\u003e\n{\n  public long? UserId { get; set; }\n  public string UserName { get; set; }\n}\n\n// response message\npublic class GetUserResponse\n{\n  public long UserId { get; set; }\n  public string UserName { get; set; }\n  public string Email { get; set; }\n}\n\n// service handler\npublic class GetUserService: IService\u003cGetUser\u003e\n{\n  public GetUserResponse Execute(GetUser request)\n  {\n    if (request.UserId.HasValue)\n    {\n      return GetUserById(request.UserId.Value);\n    }\n\n    return GetUserByName(request.UserName);\n  }\n\t...\n}\n```\n\nTypeScript client code example:\n\n```typescript\n// request message\npublic class GetUser implements IReturn\u003cGetUserResponse\u003e {\n  public userId?: number;\n  public userName?: string;\n\n  public createResponse() {\n    return new GetUserResponse();\n  }\n}\n\n// response message\npublic class GetUserResponse {\n  userId: number;\n  userName: string;\n  email: string;\n}\n\n// client code\nconst client = new JsonClient(\"ws://localhost:8765/\");\n\nconst getUser = new GetUser();\ngetUser.userId = 7;\n\nconst result = await client.call(getUser);\n```\n\n## JSON-RPC messages for the above example\n\nNormal method execution:\n\n```\n→ { \"jsonrpc\": \"2.0\", \"method\": \"GetUser\", \"params\": { \"UserID\": 1 }, \"id\": 1 }\n← { \"jsonrpc\": \"2.0\", \"result\": { \"UserID\": 1, \"UserName\": \"root\", \"Email\": \"noreply@example.com\" }, \"id\": 1 }\n```\n\nServer reply when the method is not found:\n\n```\n← { \"jsonrpc\": \"2.0\", \"error\": { \"code\": -32601, \"message\": \"Method not found\"}, \"id\": \"1\" }\n```\n\nEvent subscription (one-way call):\n\n```\n→ { \"jsonrpc\": \"2.0\", \"method\": \"rpc.subscribe\", \"params\": [ \"FeedUpdated\", \"MessageSent\" ] }\n```\n\nEvent unsubscription (one-way call):\n\n```\n→ { \"jsonrpc\": \"2.0\", \"method\": \"rpc.unsubscribe\", \"params\": [ \"MessageSent\" ] }\n```\n\nServer-side notification:\n\n```\n← { \"jsonrpc\": \"2.0\", \"method\": \"MessageSent\", params: { \"text\": \"Hello world!\" } }\n```\n\n## Transport-specific notes\n\n### WebSockets (via WebSocketSharp)\n\n* Implements both client and server\n* Supports both IP addresses and host names, i.e. ws://localhost:8765\n* .NET 4.5 only\n* Chrome browser's WebSocket implementation connects to WebSocketSharp server\n* Node.js ws module seem to have troubles connecting to WebSocketSharp server\n\n### WebSockets (via Fleck)\n\n* Implements only server (WebSocketSharp client can connect to Flex server)\n* Supports only IP addresses, i.e. ws://127.0.0.1:8765\n* .NET 4.5 and .NET Standard 2.0\n* Chrome browser's WebSocket implementation connects to Fleck server\n* Node.js ws module also connects to Fleck server\n\n### ZeroMQ (via NetMQ)\n\n* Implements both client and server\n* Supports only tcp protocol\n* .NET 4.5 and .NET Standard 2.0\n* Browsers are unable to connect to ZeroMQ endpoints\n* Node.js in theory should be able to connect using zeromq.js npm (not tested)\n\n## SDK versioning\n\nThe project uses [Nerdbank.GitVersioning](https://github.com/dotnet/Nerdbank.GitVersioning) tool to manage versions.  \nEach library build can be traced back to the original git commit.\n\n### Preparing and publishing a new release\n\n1. Make sure that `nbgv` dotnet CLI tool is installed and is up to date\n2. Run `nbgv prepare-release` to create a stable branch for the upcoming release, i.e. release/v1.0\n3. Switch to the release branch: `git checkout release/v1.0`\n4. Execute unit tests, update the README, etc. Commit and push your changes.\n5. Run `dotnet pack -c Release` and check that it builds Nuget packages with the right version number.\n6. Run `nbgv tag release/v1.0` to tag the last commit on the release branch with your current version number, i.e. v1.0.7.\n7. Push tags as suggested by nbgv tool: `git push origin v1.0.7`\n8. Go to github project page and create a release out of the last tag v1.0.7.\n9. Verify that github workflow for publishing the nuget package has completed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyallie%2Fjsonservices","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyallie%2Fjsonservices","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyallie%2Fjsonservices/lists"}