Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for @improbable-eng/grpc-web #416

Closed
euskadi31 opened this issue Jan 13, 2023 · 1 comment
Closed

Add support for @improbable-eng/grpc-web #416

euskadi31 opened this issue Jan 13, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@euskadi31
Copy link

Is your feature request related to a problem? Please describe.

I would like to use @improbable-eng/grpc-web as a gRPC client to be able to use bidirectional streams

Describe the solution you'd like

Something similar to this but for @improbable-eng/grpc-web

import * as grpc from "@grpc/grpc-js";

const client = createGrpcClient(ElizaService, { 
   address: "localhost",
   channelCredentials: grpc.ChannelCredentials.createInsecure()
});

client.say({ sentence: "Hello" }, (err: grpc.ServiceError | null, value?: SayResponse) => {
  //       
});
@euskadi31 euskadi31 added the enhancement New feature or request label Jan 13, 2023
@timostamm
Copy link
Member

@euskadi31, according to their README, @improbable-eng/grpc-web is a:

Library for making gRPC-Web requests from a browser

@bufbuild/connect-web implements the Connect protocol, but it also implements the gRPC-web protocol. To make a request with gRPC-web:

import { createGrpcWebTransport } from "@bufbuild/connect-web";

const transport = createGrpcWebTransport({
  baseUrl: "http://localhost",
});
const client = createPromiseClient(ElizaService, transport);
const res = await client.say({sentence: "Hello"});

You can find the documentation here.

If you are asking for callback-based clients, you can simply use createCallbackClient() instead of createPromiseClient(). You also have to option to create your own client. This is documented here.

Closing this, but please feel free to comment in case I missed something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants