1.0.1 • Published 5 years ago

grpc-mp v1.0.1

Weekly downloads
2
License
Apache-2.0
Repository
github
Last release
5 years ago

grpc-mp

  • support wechat miniprogram
  • 增加微信小程序支持
  • 增加 fromObject 方法

install grpc-mp

$ npm install grpc-mp
or
$ yarn add grpc-mp

prepare for mac

$ sudo xcode-select --install
$ sudo /opt/local/bin/port install autoconf automake libtool

build grpc-web

$ git clone https://github.com/11os/grpc-web.git
$ cd grpc-web
$ make install-plugin

dist protoc-gen-grpc-web

build protoc

$ git clone https://github.com/11os/protobuf.git
$ cd protobuf
$ git submodule update --init --recursive
$ ./autogen.sh
$ ./configure
$ make

dist ./src/protoc ./src/.lib

example

genreate pb & grpc_web_pb

$ protoc ./*.proto \
--js_out=import_style=miniprogram:./src \
--grpc-web_out=import_style=miniprogram,mode=grpcwebtext:./src

  1. 目前必须使用 mode=grpcwebtext,mode=grpcweb 在微信开发者工具与 iOS 真机调试中可以完美使用,但是在 android 真机中返回的 arraybuffer 在前 4 后 3 多出 7 位,造成解析不正常
  2. 需要搭配(11os/protobuf -> protoc)与(11os/grpc-web -> protoc-gen-grpc-web)使用,扩展了小程序相关的代码