11# Getting started
22
3- So you decided to go with RSP , let's make it quick. What do you need?
3+ So you decided to go with rRPC , let's make it quick. What do you need?
44
55<warning >
6- RSP is still under development, backward compatibility for communication model is not guaranteed until 1.0. For now,
6+ rRPC is still under development, backward compatibility for communication model is not guaranteed until 1.0. For now,
77existing API is more likely to be as-is, but we need more feedback.
88</warning >
99
@@ -13,20 +13,20 @@ First of all, you need a gradle plugin and the following dependencies:
1313
1414``` Kotlin
1515plugins {
16- id(" org.timemates.rsp " ) version (" %lib-version%" )
16+ id(" org.timemates.rrpc " ) version (" %lib-version%" )
1717}
1818
1919// ...
2020
2121dependencies {
2222 // for server (jvm, js, native)
23- commonMainImplementation(" org.timemates.rsp :server-core:$version " )
23+ commonMainImplementation(" org.timemates.rrpc :server-core:$version " )
2424
2525 // for client (jvm, js, native)
26- commonMainImplementation(" org.timemates.rsp :client-core:$version " )
26+ commonMainImplementation(" org.timemates.rrpc :client-core:$version " )
2727
2828 // for server & client (jvm, js, native)
29- commonMainImplementation(" org.timemates.rsp :common-core:$version " )
29+ commonMainImplementation(" org.timemates.rrpc :common-core:$version " )
3030}
3131```
3232
@@ -35,50 +35,42 @@ for [`rsocket-kotlin`](https://github.com/rsocket/rsocket-kotlin?tab=readme-ov-f
3535
3636## Initialization
3737
38- RSP generates code depending on the schema you specify in ` .proto ` files,
38+ rRPC generates code depending on the schema you specify in ` .proto ` files,
3939similar to gRPC. You can learn more about protobuf [ here] ( https://protobuf.dev/ ) .
4040
4141### Gradle Plugin
4242
43- Let's start with configuring RSP gradle plugin:
43+ Let's start with configuring rRPC gradle plugin:
4444
4545``` Kotlin
46- rsp {
46+ rrpc {
4747 // you might need to specify your main
4848 // source set (if its name is not commonMain / main)
4949 targetSourceSet = " commonMain"
5050
51- profile {
52- // enables code-generation for client
53- client = true
54-
55- // enables code-generation for client
56- server = true
57- }
58-
59- paths {
60- // folder with .proto schema files
61- protoSources = " src/commonMain/proto"
62-
63- // folder where generated code will be put
64- generationOutput = " generated/rsp/src/commonMain"
65- }
51+ // folder with .proto schema files (it may have multiple sources)
52+ protoSources.add(" src/commonMain/proto" )
6653
54+ // global options
6755 options {
68- // indicates what builder types should be generated
69- // CLASSIC – means plain java builder, mainly for compatibility
70- // with Java
71- builderTypes = setOf (
72- MessageBuilderType .CLASSIC ,
73- MessageBuilderType .DSL ,
74- )
56+ permitPackageCycles = true
57+ }
58+
59+ configurations {
60+ kotlin {
61+ // kotlin-specific options
62+ options {
63+ generateServer = true
64+ generateClient = true
7565
76- // if java is specified, it'll generate bridge for java
77- // for now, it's not supported, but will be soon.
78- targetLanguages = setOf (
79- TargetLanguage .JAVA ,
80- TargetLanguage .KOTLIN ,
81- )
66+ // folder where generated code will be put
67+ generationOutput = " generated/rrpc/src/commonMain"
68+ }
69+ }
70+
71+ // or other languages (configurations)
72+ typescript {/* ... */ }
73+ getByName(" php" ) {/* ... */ }
8274 }
8375}
8476```
@@ -102,7 +94,7 @@ service BarService {
10294After you finished with your ProtoBuf definitions, you can use the following:
10395
10496``` Bash
105- ./gradlew :rsp :generateCode
97+ ./gradlew :rrpc :generateCode
10698```
10799
108100### Server
@@ -127,7 +119,7 @@ And then you can use it whether with WebSockets or Sockets (via Ktor):
127119 <code-block lang="kotlin">
128120 fun Application.configureServer() {
129121 routing {
130- rspEndpoint ("/rsp ") { // this: RSPModuleBuilder
122+ rrpcEndpoint ("/rrpc ") { // this: rRPCModuleBuilder
131123 service(BarServiceImpl())
132124 }
133125 }
@@ -139,7 +131,7 @@ And then you can use it whether with WebSockets or Sockets (via Ktor):
139131 <code-block lang="kotlin">
140132 val server: TcpServer = server.bind(transport) {
141133 RSocketRequestHandler {
142- RSPModuleHandler (module).setup(this)
134+ rRPCModuleHandler (module).setup(this)
143135 }
144136 }
145137 server.handlerJob.join() //wait for server to finish
@@ -150,7 +142,7 @@ And then you can use it whether with WebSockets or Sockets (via Ktor):
150142### Client
151143For client, you simply initialize the class with the name of service + 'Client':
152144``` Kotlin
153- val configuration = RSPClientConfig {
145+ val configuration = rRPCClientConfig {
154146 // assume we have a rsocket client instance
155147 // for obtaining a right one, please refer to the
156148 // rsocket-kotlin documentation.
@@ -165,6 +157,6 @@ All other things, like ability to reconnect automatically, you can find
165157at [ the official documentation] ( https://github.com/rsocket/rsocket-kotlin/blob/master/README.md ) .
166158
167159<seealso >
168- <a href="" type="start" summary="Install and start quickly with RSP ">Getting started</a>
169- <a href="" type="idea" summary="The idea and motivation behind RSP development">Why RSP ?</a>
160+ <a href="" type="start" summary="Install and start quickly with rRPC ">Getting started</a>
161+ <a href="" type="idea" summary="The idea and motivation behind rRPC development">Why rRPC ?</a>
170162</seealso >
0 commit comments