tree: a160c4c2dce9ae281a9911291543da4ae7010acf [path history] [tgz]
  1. src/
  2. package.json
  3. README.md
  4. tsconfig.json
packages/dubbo-web/README.md

@apachedubbo/dubbo-web

Dubbo is a family of libraries for building and consuming APIs on different languages and platforms. @apachedubbo/dubbo brings type-safe APIs with Protobuf to TypeScript.

@apachedubbo/dubbo-web provides the following adapters for web browsers, and any other platform that has the fetch API on board:

createDubboTransport()

Lets your clients running in the web browser talk to a server with the Dubbo protocol:

import { createPromiseClient } from "@apachedubbo/dubbo";
+ import { createDubboTransport } from "@apachedubbo/dubbo-web";
import { ElizaService } from "./gen/eliza_dubbo.js";

+ // A transport for clients using the Dubbo protocol with fetch()
+ const transport = createDubboTransport({
+   baseUrl: "https://demo.connect.build",
+ });

const client = createPromiseClient(ElizaService, transport);
const { sentence } = await client.say({ sentence: "I feel happy." });
console.log(sentence) // you said: I feel happy.

createGrpcWebTransport()

Lets your clients running in the web browser talk to a server with the gRPC-web protocol:

import { createPromiseClient } from "@apachedubbo/dubbo";
+ import { createGrpcWebTransport } from "@apachedubbo/dubbo-web";
import { ElizaService } from "./gen/eliza_dubbo.js";

+ // A transport for clients using the Dubbo protocol with fetch()
+ const transport = createGrpcWebTransport({
+   baseUrl: "https://demo.connect.build",
+ });

const client = createPromiseClient(ElizaService, transport);
const { sentence } = await client.say({ sentence: "I feel happy." });
console.log(sentence) // you said: I feel happy.

Getting started

To get started with Dubbo, head over to the docs for a tutorial, or take a look at our example.

Dubbo plays nice with Vue, Svelte, Remix, Next.js, Angular and many others. Take a look at our examples for various frameworks.