From 46a2019df34a186fc32c6261fd3f00eff56e8185 Mon Sep 17 00:00:00 2001 From: liu-samuel Date: Wed, 15 Nov 2023 19:05:32 -0500 Subject: [PATCH 01/14] initial commit --- Topics/Tech_Stacks/JSONRPC.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Topics/Tech_Stacks/JSONRPC.md diff --git a/Topics/Tech_Stacks/JSONRPC.md b/Topics/Tech_Stacks/JSONRPC.md new file mode 100644 index 000000000..21411c169 --- /dev/null +++ b/Topics/Tech_Stacks/JSONRPC.md @@ -0,0 +1,5 @@ +# JSON-RPC + +## Introduction +JSON-RPC is a remote procedure call protocol encoded in JSON. Like REST, it is used for API calls, but there are also differences. JSON-RPC focuses on remote procedure calls whereas the more popular REST is more focused on resource manipulation. JSON RPC +has better security because the procedure is masked, so the only thing that is exposed is the endpoints. \ No newline at end of file From db0e32457b2070ebe777c056a4ee7fd3be04d3a1 Mon Sep 17 00:00:00 2001 From: liu-samuel Date: Wed, 15 Nov 2023 19:05:57 -0500 Subject: [PATCH 02/14] initial commit --- Topics/Tech_Stacks/JSONRPC.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Topics/Tech_Stacks/JSONRPC.md b/Topics/Tech_Stacks/JSONRPC.md index 21411c169..650f7e6a5 100644 --- a/Topics/Tech_Stacks/JSONRPC.md +++ b/Topics/Tech_Stacks/JSONRPC.md @@ -2,4 +2,5 @@ ## Introduction JSON-RPC is a remote procedure call protocol encoded in JSON. Like REST, it is used for API calls, but there are also differences. JSON-RPC focuses on remote procedure calls whereas the more popular REST is more focused on resource manipulation. JSON RPC -has better security because the procedure is masked, so the only thing that is exposed is the endpoints. \ No newline at end of file +has better security because the procedure is masked, so the only thing that is exposed is the endpoints and the parameters +used to call them. \ No newline at end of file From c5c1ebd3c5a711cfd8653b19b098e88ac0d26116 Mon Sep 17 00:00:00 2001 From: liu-samuel Date: Wed, 15 Nov 2023 19:12:57 -0500 Subject: [PATCH 03/14] commit --- Topics/Tech_Stacks/JSONRPC.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Topics/Tech_Stacks/JSONRPC.md b/Topics/Tech_Stacks/JSONRPC.md index 650f7e6a5..c80a00944 100644 --- a/Topics/Tech_Stacks/JSONRPC.md +++ b/Topics/Tech_Stacks/JSONRPC.md @@ -2,5 +2,4 @@ ## Introduction JSON-RPC is a remote procedure call protocol encoded in JSON. Like REST, it is used for API calls, but there are also differences. JSON-RPC focuses on remote procedure calls whereas the more popular REST is more focused on resource manipulation. JSON RPC -has better security because the procedure is masked, so the only thing that is exposed is the endpoints and the parameters -used to call them. \ No newline at end of file +has better security but also puts the user more in the dark because the procedure is masked, so the only thing that is exposed is the endpoints and the parameters used to call them. REST is generally easier to implement through being able to control information like HTTP headers and representation. Client implementations do not have to rely on endpoint names but message formats instead. JSON RPC is generally more complicated and more useful for large application that go past simple CRUD applicatons, where REST would be the simpler choice. \ No newline at end of file From f74187666b01a5ed57e1d5c4b08f401908796db4 Mon Sep 17 00:00:00 2001 From: liu-samuel Date: Sun, 19 Nov 2023 22:25:05 -0500 Subject: [PATCH 04/14] adding more context for JSON-RPC --- Topics/Tech_Stacks.md | 1 + Topics/Tech_Stacks/JSONRPC.md | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Topics/Tech_Stacks.md b/Topics/Tech_Stacks.md index dfd16e46e..5e23a3a20 100644 --- a/Topics/Tech_Stacks.md +++ b/Topics/Tech_Stacks.md @@ -12,3 +12,4 @@ ### [Learning TypeScript](./Tech_Stacks/TypeScript.md) ### [Learning JavaScript](./Tech_Stacks/JavaScript.md) ### [Learning React Native](./Tech_Stacks/ReactNative.md) +### [Learning JSON-RPC](./Tech_Stacks/JSONRPC.md) diff --git a/Topics/Tech_Stacks/JSONRPC.md b/Topics/Tech_Stacks/JSONRPC.md index c80a00944..6b2acfb20 100644 --- a/Topics/Tech_Stacks/JSONRPC.md +++ b/Topics/Tech_Stacks/JSONRPC.md @@ -1,5 +1,11 @@ -# JSON-RPC +### JSON-RPC ## Introduction -JSON-RPC is a remote procedure call protocol encoded in JSON. Like REST, it is used for API calls, but there are also differences. JSON-RPC focuses on remote procedure calls whereas the more popular REST is more focused on resource manipulation. JSON RPC -has better security but also puts the user more in the dark because the procedure is masked, so the only thing that is exposed is the endpoints and the parameters used to call them. REST is generally easier to implement through being able to control information like HTTP headers and representation. Client implementations do not have to rely on endpoint names but message formats instead. JSON RPC is generally more complicated and more useful for large application that go past simple CRUD applicatons, where REST would be the simpler choice. \ No newline at end of file +JSON-RPC is a an approach to building APIs for communication between different software systems. The most common approach is REST, but JSON-RPC offers its own advantages. Like REST, JSON-RPC uses JSON for its data format and uses HTTP as a transport protocol. JSON-RPC focuses on remote procedure calls whereas the more popular REST is more focused on resource manipulation. REST is generally easier to implement through being able to control information like HTTP headers and representation. Client implementations do not have to rely on endpoint names but message formats instead. JSON RPC is generally more complicated and more useful for large application that go past simple CRUD applicatons, where REST would be the simpler choice. + +JSONRPC calls are represented by sending request objects to a server. These request objects contain the method to be called, parameters values that are passed into the method, an id that established by the client, and jsonrpc string that specifies the version of the JSON-RPC protocol. + +The response object contains a result, which contains the correct value when the method results in a success, an error in cases where the method throws an error, and a jsonrpc string and id that are identical to the one in the request object. + +Here is some basic documentation on JSON-RPC https://www.jsonrpc.org/specification + From bea5672cfef7e98c861d58dac98c25bf6d28b603 Mon Sep 17 00:00:00 2001 From: liu-samuel Date: Sun, 19 Nov 2023 22:35:17 -0500 Subject: [PATCH 05/14] explaining benefis of jsonrpc --- Topics/Tech_Stacks/JSONRPC.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Topics/Tech_Stacks/JSONRPC.md b/Topics/Tech_Stacks/JSONRPC.md index 6b2acfb20..eea8cfe5d 100644 --- a/Topics/Tech_Stacks/JSONRPC.md +++ b/Topics/Tech_Stacks/JSONRPC.md @@ -7,5 +7,7 @@ JSONRPC calls are represented by sending request objects to a server. These requ The response object contains a result, which contains the correct value when the method results in a success, an error in cases where the method throws an error, and a jsonrpc string and id that are identical to the one in the request object. +JSONRPC is very useful for a variety of reasons. It is simple and very straight forward due to its stsandard of remote procedure calls, making it easy to implement and understand. In addition, it serializes data in JSON format and is able to be implemented in a variety of languages, making it flexible. + Here is some basic documentation on JSON-RPC https://www.jsonrpc.org/specification From 37dfe8731e6223f5ba54a57d1e731177def2bf3f Mon Sep 17 00:00:00 2001 From: liu-samuel Date: Sun, 19 Nov 2023 22:50:04 -0500 Subject: [PATCH 06/14] wip --- Topics/Tech_Stacks/JSONRPC.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Topics/Tech_Stacks/JSONRPC.md b/Topics/Tech_Stacks/JSONRPC.md index eea8cfe5d..242233e8e 100644 --- a/Topics/Tech_Stacks/JSONRPC.md +++ b/Topics/Tech_Stacks/JSONRPC.md @@ -1,7 +1,11 @@ ### JSON-RPC ## Introduction -JSON-RPC is a an approach to building APIs for communication between different software systems. The most common approach is REST, but JSON-RPC offers its own advantages. Like REST, JSON-RPC uses JSON for its data format and uses HTTP as a transport protocol. JSON-RPC focuses on remote procedure calls whereas the more popular REST is more focused on resource manipulation. REST is generally easier to implement through being able to control information like HTTP headers and representation. Client implementations do not have to rely on endpoint names but message formats instead. JSON RPC is generally more complicated and more useful for large application that go past simple CRUD applicatons, where REST would be the simpler choice. +JSON-RPC is a an approach to building APIs for communication between different software systems. The most common way of developing APIs is utilizing REST, but JSON-RPC offers its own advantages. Like REST, JSON-RPC uses JSON for its data format and uses HTTP as a transport protocol. JSON-RPC focuses on remote procedure calls whereas the more popular REST is more focused on resource manipulation. + +This makes it so JSON-RPC is a better option in scenarios where actions take place on a remote system. For example, a good time to JSON-RPC is transfering money between bank account on a remote system. + +REST is generally more useful in situations where actions such such as adding data to databases or updating information are needed due to its ability to easily perform CRUD operations. JSONRPC calls are represented by sending request objects to a server. These request objects contain the method to be called, parameters values that are passed into the method, an id that established by the client, and jsonrpc string that specifies the version of the JSON-RPC protocol. @@ -11,3 +15,4 @@ JSONRPC is very useful for a variety of reasons. It is simple and very straight Here is some basic documentation on JSON-RPC https://www.jsonrpc.org/specification +Read more about the differences between remote procedure calls and rest here https://aws.amazon.com/compare/the-difference-between-rpc-and-rest/ From 05ab6fbb097202ecb15e97079c6745eb8079ecd3 Mon Sep 17 00:00:00 2001 From: liu-samuel Date: Sun, 19 Nov 2023 22:52:30 -0500 Subject: [PATCH 07/14] more info --- Topics/Tech_Stacks/JSONRPC.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Topics/Tech_Stacks/JSONRPC.md b/Topics/Tech_Stacks/JSONRPC.md index 242233e8e..e485f892f 100644 --- a/Topics/Tech_Stacks/JSONRPC.md +++ b/Topics/Tech_Stacks/JSONRPC.md @@ -7,11 +7,16 @@ This makes it so JSON-RPC is a better option in scenarios where actions take pla REST is generally more useful in situations where actions such such as adding data to databases or updating information are needed due to its ability to easily perform CRUD operations. + +#### Request and Repsonse of JSON-RPC Calls + +JSON-RPC calls require two things, which are called request objects and response objects. Request objects are what are send to the server during a JSON-RPC method call, and the response object is what is expected as output at the end of the method call. + JSONRPC calls are represented by sending request objects to a server. These request objects contain the method to be called, parameters values that are passed into the method, an id that established by the client, and jsonrpc string that specifies the version of the JSON-RPC protocol. The response object contains a result, which contains the correct value when the method results in a success, an error in cases where the method throws an error, and a jsonrpc string and id that are identical to the one in the request object. -JSONRPC is very useful for a variety of reasons. It is simple and very straight forward due to its stsandard of remote procedure calls, making it easy to implement and understand. In addition, it serializes data in JSON format and is able to be implemented in a variety of languages, making it flexible. +JSONRPC is very useful for a variety of reasons. It is simple and very straight forward due to its standard of remote procedure calls, making it easy to implement and understand. In addition, it serializes data in JSON format and is able to be implemented in a variety of languages, making it flexible. Here is some basic documentation on JSON-RPC https://www.jsonrpc.org/specification From 679f897454f5e3d165e32f5d812968897763dbc3 Mon Sep 17 00:00:00 2001 From: liu-samuel Date: Sun, 19 Nov 2023 23:08:51 -0500 Subject: [PATCH 08/14] change link --- Topics/Tech_Stacks/JSONRPC.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Topics/Tech_Stacks/JSONRPC.md b/Topics/Tech_Stacks/JSONRPC.md index e485f892f..36b0f0815 100644 --- a/Topics/Tech_Stacks/JSONRPC.md +++ b/Topics/Tech_Stacks/JSONRPC.md @@ -1,16 +1,16 @@ ### JSON-RPC ## Introduction -JSON-RPC is a an approach to building APIs for communication between different software systems. The most common way of developing APIs is utilizing REST, but JSON-RPC offers its own advantages. Like REST, JSON-RPC uses JSON for its data format and uses HTTP as a transport protocol. JSON-RPC focuses on remote procedure calls whereas the more popular REST is more focused on resource manipulation. +JSON-RPC is a an approach to building APIs for communication between different software systems. Let's compare it to REST, which is the most common way of developing APIs. JSON-RPC is not as popular, but it offers its own advantages. Like REST, JSON-RPC uses JSON for its data format and uses HTTP as a transport protocol. JSON-RPC focuses on remote procedure calls whereas the more popular REST is more focused on resource manipulation. -This makes it so JSON-RPC is a better option in scenarios where actions take place on a remote system. For example, a good time to JSON-RPC is transfering money between bank account on a remote system. +This makes it so JSON-RPC is a better option in scenarios where remote functions have to be called on a server that require an action result. It's most useful for when complex calculations or calling remote procedures on the server are needed. For example, a good time to JSON-RPC is transfering money between bank account on a remote system. -REST is generally more useful in situations where actions such such as adding data to databases or updating information are needed due to its ability to easily perform CRUD operations. +REST is generally more useful in situations where actions such as adding data to databases or updating information are needed due to its ability to easily perform CRUD operations. #### Request and Repsonse of JSON-RPC Calls -JSON-RPC calls require two things, which are called request objects and response objects. Request objects are what are send to the server during a JSON-RPC method call, and the response object is what is expected as output at the end of the method call. +JSON-RPC calls require two things, which are called request objects and response objects. Request objects are what are sent to the server during a JSON-RPC method call, and the response objects are what the server responds with at the end of the method call. JSONRPC calls are represented by sending request objects to a server. These request objects contain the method to be called, parameters values that are passed into the method, an id that established by the client, and jsonrpc string that specifies the version of the JSON-RPC protocol. @@ -20,4 +20,4 @@ JSONRPC is very useful for a variety of reasons. It is simple and very straight Here is some basic documentation on JSON-RPC https://www.jsonrpc.org/specification -Read more about the differences between remote procedure calls and rest here https://aws.amazon.com/compare/the-difference-between-rpc-and-rest/ +Read more about the differences between remote procedure calls and rest here https://nordicapis.com/whats-the-difference-between-rpc-and-rest/ From f01cd4075db528693cc9dc6d8fb5cf6e1113c079 Mon Sep 17 00:00:00 2001 From: liu-samuel Date: Mon, 20 Nov 2023 15:23:10 -0500 Subject: [PATCH 09/14] add more info --- Topics/Tech_Stacks/JSONRPC.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Topics/Tech_Stacks/JSONRPC.md b/Topics/Tech_Stacks/JSONRPC.md index 36b0f0815..d62f757b1 100644 --- a/Topics/Tech_Stacks/JSONRPC.md +++ b/Topics/Tech_Stacks/JSONRPC.md @@ -21,3 +21,5 @@ JSONRPC is very useful for a variety of reasons. It is simple and very straight Here is some basic documentation on JSON-RPC https://www.jsonrpc.org/specification Read more about the differences between remote procedure calls and rest here https://nordicapis.com/whats-the-difference-between-rpc-and-rest/ + +Here is an example of how to set up JSON-RPC using TypeScript and guide on how to install it using npm. https://www.npmjs.com/package/json-rpc-2.0 \ No newline at end of file From e95448f605b2c0b862c9badcd71f5b574777146c Mon Sep 17 00:00:00 2001 From: liu-samuel Date: Sun, 26 Nov 2023 23:57:03 -0500 Subject: [PATCH 10/14] address pr comments --- Topics/Tech_Stacks/JSONRPC.md | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/Topics/Tech_Stacks/JSONRPC.md b/Topics/Tech_Stacks/JSONRPC.md index d62f757b1..31d17cc3d 100644 --- a/Topics/Tech_Stacks/JSONRPC.md +++ b/Topics/Tech_Stacks/JSONRPC.md @@ -1,25 +1,32 @@ -### JSON-RPC +# JSON-RPC ## Introduction -JSON-RPC is a an approach to building APIs for communication between different software systems. Let's compare it to REST, which is the most common way of developing APIs. JSON-RPC is not as popular, but it offers its own advantages. Like REST, JSON-RPC uses JSON for its data format and uses HTTP as a transport protocol. JSON-RPC focuses on remote procedure calls whereas the more popular REST is more focused on resource manipulation. +JSON-RPC is an approach to building APIs for communication between different software systems. Let's compare it to REST, which is the most common way of developing APIs. JSON-RPC is not as popular, but it offers its own advantages. Like REST, JSON-RPC uses JSON for its data format and uses HTTP as a transport protocol. JSON-RPC focuses on remote procedure calls whereas the more popular REST is more focused on resource manipulation. + +This makes it so that JSON-RPC is a better option in scenarios where remote functions have to be called on a server that require an action result. It's most useful for when complex calculations or calling remote procedures on the server are needed. For example, a good time to use JSON-RPC is transferring money between bank accounts on a remote system. + +REST is generally more useful in situations where actions such as adding data to databases or updating information are needed due to its ability to easily perform CRUD operations. [Read more about the differences between remote procedure calls and REST here](https://nordicapis.com/whats-the-difference-between-rpc-and-rest/). Below is a representation of how REST works. + + +![Rest Visualization](https://www.altexsoft.com/static/blog-post/2023/11/72f74918-0345-4be1-bed3-08d1cfe138cc.webp) -This makes it so JSON-RPC is a better option in scenarios where remote functions have to be called on a server that require an action result. It's most useful for when complex calculations or calling remote procedures on the server are needed. For example, a good time to JSON-RPC is transfering money between bank account on a remote system. -REST is generally more useful in situations where actions such as adding data to databases or updating information are needed due to its ability to easily perform CRUD operations. #### Request and Repsonse of JSON-RPC Calls JSON-RPC calls require two things, which are called request objects and response objects. Request objects are what are sent to the server during a JSON-RPC method call, and the response objects are what the server responds with at the end of the method call. -JSONRPC calls are represented by sending request objects to a server. These request objects contain the method to be called, parameters values that are passed into the method, an id that established by the client, and jsonrpc string that specifies the version of the JSON-RPC protocol. +JSON-RPC calls are represented by sending request objects to a server. These request objects contain the method to be called, parameters values that are passed into the method, an id that established by the client, and JSON-RPC string that specifies the version of the JSON-RPC protocol. Below is a representation of JSON-RPC in action. + +![JSON-RPC Visualization](https://assets-global.website-files.com/5ff66329429d880392f6cba2/61b76e7fdf48bbef0026f39a_JSON%20works.png) -The response object contains a result, which contains the correct value when the method results in a success, an error in cases where the method throws an error, and a jsonrpc string and id that are identical to the one in the request object. +The response object contains a result, which contains the correct value when the method results in a success, an error in cases where the method throws an error, and a JSON-RPC string and id that are identical to the one in the request object. -JSONRPC is very useful for a variety of reasons. It is simple and very straight forward due to its standard of remote procedure calls, making it easy to implement and understand. In addition, it serializes data in JSON format and is able to be implemented in a variety of languages, making it flexible. +JSON-RPC is very useful for a variety of reasons. It is simple and very straight forward due to its standard of remote procedure calls, making it easy to implement and understand. In addition, it serializes data in JSON format and is able to be implemented in a variety of languages, making it flexible. -Here is some basic documentation on JSON-RPC https://www.jsonrpc.org/specification +[Here is some basic documentation on JSON-RPC](https://www.jsonrpc.org/specification) -Read more about the differences between remote procedure calls and rest here https://nordicapis.com/whats-the-difference-between-rpc-and-rest/ +[Here is more on the benefits of JSON-RPC and more comparisons of JSON-RPC with REST](https://rpcfast.com/blog/remote-procedure-calls-what-is-json-rpc) -Here is an example of how to set up JSON-RPC using TypeScript and guide on how to install it using npm. https://www.npmjs.com/package/json-rpc-2.0 \ No newline at end of file +[Here is an example of how to set up JSON-RPC using TypeScript and guide on how to install it using npm](https://www.npmjs.com/package/json-rpc-2.0) \ No newline at end of file From a688fd798d52203d82568fed67b481cf6ea34e4a Mon Sep 17 00:00:00 2001 From: liu-samuel Date: Mon, 27 Nov 2023 00:02:58 -0500 Subject: [PATCH 11/14] simplify terminology --- Topics/Tech_Stacks/JSONRPC.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Topics/Tech_Stacks/JSONRPC.md b/Topics/Tech_Stacks/JSONRPC.md index 31d17cc3d..6cb0b953f 100644 --- a/Topics/Tech_Stacks/JSONRPC.md +++ b/Topics/Tech_Stacks/JSONRPC.md @@ -1,9 +1,9 @@ # JSON-RPC ## Introduction -JSON-RPC is an approach to building APIs for communication between different software systems. Let's compare it to REST, which is the most common way of developing APIs. JSON-RPC is not as popular, but it offers its own advantages. Like REST, JSON-RPC uses JSON for its data format and uses HTTP as a transport protocol. JSON-RPC focuses on remote procedure calls whereas the more popular REST is more focused on resource manipulation. +JSON-RPC is an approach to building APIs for communication between different software systems. Let's compare it to REST, which is the most common way of developing APIs. JSON-RPC is not as popular, but it offers its own advantages. Like REST, JSON-RPC uses JSON for its data format and uses HTTP as a transport protocol. JSON-RPC is mainly focused on calling functions or procedures on a remote server and asking this server to perform a certain action. On the other hand, REST is focused on working with and changing data. -This makes it so that JSON-RPC is a better option in scenarios where remote functions have to be called on a server that require an action result. It's most useful for when complex calculations or calling remote procedures on the server are needed. For example, a good time to use JSON-RPC is transferring money between bank accounts on a remote system. +This makes it so that JSON-RPC is a better option in scenarios where remote functions have to be called on a server that require an action result. For example, a good time to use JSON-RPC is transferring money between bank accounts on a remote system. REST is generally more useful in situations where actions such as adding data to databases or updating information are needed due to its ability to easily perform CRUD operations. [Read more about the differences between remote procedure calls and REST here](https://nordicapis.com/whats-the-difference-between-rpc-and-rest/). Below is a representation of how REST works. From 74ef507cd859a1e99e1cc18adc066d227ada9c0f Mon Sep 17 00:00:00 2001 From: liu-samuel Date: Mon, 27 Nov 2023 00:06:16 -0500 Subject: [PATCH 12/14] add info --- Topics/Tech_Stacks/JSONRPC.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Topics/Tech_Stacks/JSONRPC.md b/Topics/Tech_Stacks/JSONRPC.md index 6cb0b953f..9e123dd44 100644 --- a/Topics/Tech_Stacks/JSONRPC.md +++ b/Topics/Tech_Stacks/JSONRPC.md @@ -17,13 +17,13 @@ REST is generally more useful in situations where actions such as adding data to JSON-RPC calls require two things, which are called request objects and response objects. Request objects are what are sent to the server during a JSON-RPC method call, and the response objects are what the server responds with at the end of the method call. -JSON-RPC calls are represented by sending request objects to a server. These request objects contain the method to be called, parameters values that are passed into the method, an id that established by the client, and JSON-RPC string that specifies the version of the JSON-RPC protocol. Below is a representation of JSON-RPC in action. +JSON-RPC calls are represented by sending request objects to a server. These request objects contain the method to be called, parameters values that are passed into the method, an id that established by the client, and JSON-RPC string that specifies the version of the JSON-RPC protocol. -![JSON-RPC Visualization](https://assets-global.website-files.com/5ff66329429d880392f6cba2/61b76e7fdf48bbef0026f39a_JSON%20works.png) +The response object contains a result, which contains the correct value when the method results in a success, an error in cases where the method throws an error, and a JSON-RPC string and id that are identical to the one in the request object. Below is a representation of JSON-RPC in action. -The response object contains a result, which contains the correct value when the method results in a success, an error in cases where the method throws an error, and a JSON-RPC string and id that are identical to the one in the request object. +![JSON-RPC Visualization](https://assets-global.website-files.com/5ff66329429d880392f6cba2/61b76e7fdf48bbef0026f39a_JSON%20works.png) -JSON-RPC is very useful for a variety of reasons. It is simple and very straight forward due to its standard of remote procedure calls, making it easy to implement and understand. In addition, it serializes data in JSON format and is able to be implemented in a variety of languages, making it flexible. +JSON-RPC is very useful for a variety of reasons. It is simple and very straight forward due to its standard of remote procedure calls, making it easy to implement and understand. This also makes it so products built with JSON-RPC end up being more scalable. In addition, it serializes data in JSON format and is able to be implemented in a variety of languages, making it flexible. [Here is some basic documentation on JSON-RPC](https://www.jsonrpc.org/specification) From e2b58574bbf73e62c708db609ef2de1c05ca58d0 Mon Sep 17 00:00:00 2001 From: liu-samuel Date: Mon, 27 Nov 2023 00:10:53 -0500 Subject: [PATCH 13/14] add summary sentence --- Topics/Tech_Stacks/JSONRPC.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Topics/Tech_Stacks/JSONRPC.md b/Topics/Tech_Stacks/JSONRPC.md index 9e123dd44..bef169ad7 100644 --- a/Topics/Tech_Stacks/JSONRPC.md +++ b/Topics/Tech_Stacks/JSONRPC.md @@ -23,7 +23,11 @@ The response object contains a result, which contains the correct value when the ![JSON-RPC Visualization](https://assets-global.website-files.com/5ff66329429d880392f6cba2/61b76e7fdf48bbef0026f39a_JSON%20works.png) -JSON-RPC is very useful for a variety of reasons. It is simple and very straight forward due to its standard of remote procedure calls, making it easy to implement and understand. This also makes it so products built with JSON-RPC end up being more scalable. In addition, it serializes data in JSON format and is able to be implemented in a variety of languages, making it flexible. +JSON-RPC is very useful for a variety of reasons. It is simple and very straight forward due to its standard of remote procedure calls, making it easy to implement and understand. This also makes it so products built with JSON-RPC end up being more scalable. In addition, it serializes data in JSON format and is able to be implemented in a variety of languages, making it flexible. Furthermore, JSON-RPC has standardized error handling, making debugging and troubleshooting a smoother process. + +Overall, JSON-RPC is a great tool due to its lightweight design and ease of implementation, making it a versatile and efficient choice for remote procedure calls in various applications. + +Below are some more resources related to JSON-RPC [Here is some basic documentation on JSON-RPC](https://www.jsonrpc.org/specification) From bd50923c5e9135a320129f294c861d8aab37359e Mon Sep 17 00:00:00 2001 From: liu-samuel Date: Mon, 27 Nov 2023 00:21:48 -0500 Subject: [PATCH 14/14] add code blocks --- Topics/Tech_Stacks/JSONRPC.md | 42 ++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/Topics/Tech_Stacks/JSONRPC.md b/Topics/Tech_Stacks/JSONRPC.md index bef169ad7..42c16e6ba 100644 --- a/Topics/Tech_Stacks/JSONRPC.md +++ b/Topics/Tech_Stacks/JSONRPC.md @@ -1,30 +1,56 @@ # JSON-RPC -## Introduction +### Introduction JSON-RPC is an approach to building APIs for communication between different software systems. Let's compare it to REST, which is the most common way of developing APIs. JSON-RPC is not as popular, but it offers its own advantages. Like REST, JSON-RPC uses JSON for its data format and uses HTTP as a transport protocol. JSON-RPC is mainly focused on calling functions or procedures on a remote server and asking this server to perform a certain action. On the other hand, REST is focused on working with and changing data. This makes it so that JSON-RPC is a better option in scenarios where remote functions have to be called on a server that require an action result. For example, a good time to use JSON-RPC is transferring money between bank accounts on a remote system. -REST is generally more useful in situations where actions such as adding data to databases or updating information are needed due to its ability to easily perform CRUD operations. [Read more about the differences between remote procedure calls and REST here](https://nordicapis.com/whats-the-difference-between-rpc-and-rest/). Below is a representation of how REST works. +REST is generally more useful in situations where actions such as adding data to databases or updating information are needed due to its ability to easily perform CRUD operations. [Read more about the differences between remote procedure calls and REST here](https://nordicapis.com/whats-the-difference-between-rpc-and-rest/). +Below is a representation of how JSON-RPC works. -![Rest Visualization](https://www.altexsoft.com/static/blog-post/2023/11/72f74918-0345-4be1-bed3-08d1cfe138cc.webp) +![JSON-RPC Visualization](https://assets-global.website-files.com/5ff66329429d880392f6cba2/61b76e7fdf48bbef0026f39a_JSON%20works.png) +#### Request and Response of JSON-RPC Calls +JSON-RPC calls require two things, which are called request objects and response objects. Request objects are what are sent to the server during a JSON-RPC method call, and the response objects are what the server responds with at the end of the method call. -#### Request and Repsonse of JSON-RPC Calls +JSON-RPC calls are represented by sending request objects to a server. These request objects contain the method to be called, parameters values that are passed into the method, an id that established by the client, and JSON-RPC string that specifies the version of the JSON-RPC protocol. -JSON-RPC calls require two things, which are called request objects and response objects. Request objects are what are sent to the server during a JSON-RPC method call, and the response objects are what the server responds with at the end of the method call. +Below is an example of a JSON object that is sent to call JSON-RPC methods. -JSON-RPC calls are represented by sending request objects to a server. These request objects contain the method to be called, parameters values that are passed into the method, an id that established by the client, and JSON-RPC string that specifies the version of the JSON-RPC protocol. +``` +{ + "jsonrpc": "2.0" + "method": + "params": { + : + : + ... + }, + "id": 1 +} +``` + +The response object contains a result, which contains the correct value when the method results in a success, an error in cases where the method throws an error, and a JSON-RPC string and id that are identical to the one in the request object. + +Below is an example of a JSON object that is returned from a JSON-RPC method. + +``` +{ + "jsonrpc": "2.0" + : + "id": 1 +} +``` -The response object contains a result, which contains the correct value when the method results in a success, an error in cases where the method throws an error, and a JSON-RPC string and id that are identical to the one in the request object. Below is a representation of JSON-RPC in action. -![JSON-RPC Visualization](https://assets-global.website-files.com/5ff66329429d880392f6cba2/61b76e7fdf48bbef0026f39a_JSON%20works.png) JSON-RPC is very useful for a variety of reasons. It is simple and very straight forward due to its standard of remote procedure calls, making it easy to implement and understand. This also makes it so products built with JSON-RPC end up being more scalable. In addition, it serializes data in JSON format and is able to be implemented in a variety of languages, making it flexible. Furthermore, JSON-RPC has standardized error handling, making debugging and troubleshooting a smoother process. + + Overall, JSON-RPC is a great tool due to its lightweight design and ease of implementation, making it a versatile and efficient choice for remote procedure calls in various applications. Below are some more resources related to JSON-RPC