Server for Web

Server uses gRPC to provide an API that clients can connect to. It is currently impossible to implement the HTTP/2 gRPC in some browsers, Envoy is required for web. For more details: gRPC-web

This page shows how to start the server for web. Overall structure is as follows:

 Browser            Envoy                  Server
┌────────┐         ┌──────────────┐       ┌───────────┐
│gRPC-web├─HTTP1.1─┤gRPC-web Proxy├─HTTP2─┤gRPC Server│
└────────┘         └──────────────┘       └───────────┘

Start Server with Envoy

Configuring Envoy by hand with its config file is cumbersome, but using Docker Compose makes it easy.

NOTE: If docker compose is not installed, install it: Install Docker Compose

First, downloads all manifests files from docker folder. Then execute the following command in the folder containing the downloaded file.

$ docker-compose up --build -d

Starting yorkie ... done
Starting envoy  ... done

This will launch the yorkie(Server) and envoy containers on your environment.

$ docker ps

IMAGE                      COMMAND                  PORTS                                  NAMES
grpcweb:envoy              "/usr/local/bin/envo…"   0.0.0.0:8080->8080/tcp                 envoy
yorkieteam/yorkie:latest   "yorkie server --ena…"   0.0.0.0:11101-11103->11101-11103/tcp   yorkie

Then, the ports of the services are bound to the host environment.

  • 8080: gRPC port for Web
  • 11101: gRPC port for SDK
  • 11102: HTML port for profiling Server
  • 11103: gRPC port for admin Server

Now lets create a client with address localhost:8080.

const client = yorkie.createClient('localhost:8080');
await client.activate();

Next, let’s take a look at the JS SDK.

Edit this page