Create a server
Learn how to create a server for a service definition.
This tutorial shows how to generate a basic gRPC service like a seat service. For this example the proto file at https://raw.githubusercontent.com/eclipse-kuksa/kuksa-incubation/0.4.0/seat_service/proto/sdv/edge/comfort/seats/v1/seats.proto is used.
All files included from services/seats
are auto-generated and added to the app project as Conan dependency.
For writing a complete gRPC service you need two velocitas apps/projects.
One is implementing a client and the other one is for providing the server.
The examples shown in this tutorial are based on three components running:
As a Velocitas developer you may use the Velocitas devenv-runtimes to deploy and run the Databroker instance, but it is also possible to connect to a Databroker running on localhost. The following setup was used for the examples:
For this to work the .devcontainer/devcontainer.json
was changed.
In the setup --network=host
was added to allow the containers to use the host network.
For the server forwardPorts": [ 5555 ]
was additionally used to forward port 5555.
"forwardPorts": [ 5555 ],
"runArgs": [
"--init",
"--privileged",
"--cap-add=SYS_PTRACE",
"--network=host",
"--security-opt",
"seccomp=unconfined"
],
Note that changes to .devcontainer/devcontainer.json
may be overwritten when velocitas sync
is performed.
To run the examples the following actions need to be performed in the shown order:
Vehicle.Cabin.Seat.Row1.DriverSide.Position
to a valid value, for example 12, using a Databroker Client (
Kuksa Python Client
or
Databroker CLI
).Vehicle.Cabin.Seat.Row1.DriverSide.Position
has been set to 75.Learn how to create a server for a service definition.
Learn how to create a client for a service definition.