@msaki/jsonrpc 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +5 -30
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -38,40 +38,15 @@ Bun.serve({
38
38
  console.log("JSON-RPC sever on http://localhost:4444")
39
39
  ```
40
40
 
41
- ### PRC Client
41
+ ### RPC Client
42
42
 
43
43
  ```ts
44
44
  import { initializeRpcClient } from "@msaki/jsonrpc";
45
45
  const url = "http://localhost:4444";
46
46
  const client = initializeRpcClient(url);
47
- const result = client.call(
48
- "rpc_method",
49
- [1, 2]
50
- );
51
- ```
52
-
53
- Or
54
-
55
- ```ts
56
- import { JsonRpcClient } from "@msaki/jsonrpc";
57
- import type {
58
- JsonRpcRequest,
59
- JsonRpcResponse
60
- } from "@msaki/jsonrpc";
61
-
62
- const url = "http://localhost:4444";
63
-
64
- const client = new JsonRpcClient(async (req: JsonRpcRequest<unknown>) => {
65
- const res = await fetch(url, {
66
- method: "POST",
67
- headers: { "Content-Type": "application/json" },
68
- body: JSON.stringify(req)
69
- });
70
-
71
- return (await res.json()) as JsonRpcResponse<unknown, number>
72
- });
73
- const result = client.call(
74
- "rpc_method",
75
- [1, 2]
47
+ const result = await client.call(
48
+ "ping",
49
+ []
76
50
  );
51
+ console.log(result)
77
52
  ```
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@msaki/jsonrpc",
3
3
  "author": "Meek Msaki",
4
- "version": "0.1.1",
4
+ "version": "0.1.2",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.mjs",