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 file stream and image stream rpc call #88

Merged
merged 7 commits into from
Oct 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ TCP hole punching

## HISTORY

### v0.18 (Oct 15, 2020)
- Add new `MessageFileStream` and `MessageImageStream` to replace the `MessageFile` and `MessageImage` method to avoid blocking nodejs event loop when sending large files ([#88](https://github.com/Chatie/grpc/pull/88)) by [@windmemory](https://github.com/windmemory)

### v0.17 (Aug 5, 2020)

- Add PHPH Support ([#76](https://github.com/Chatie/grpc/pull/76) [#78](https://github.com/Chatie/grpc/pull/78)) by [@zhangchunsheng](https://github.com/zhangchunsheng)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@chatie/grpc",
"version": "0.17.4",
"version": "0.18.0",
"description": "gRPC for Chatie",
"main": "dist/src/index.js",
"typings": "dist/src/index.d.js",
Expand Down
4 changes: 4 additions & 0 deletions proto/wechaty/puppet.proto
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,12 @@ service Puppet {
rpc MessagePayload (puppet.MessagePayloadRequest) returns (puppet.MessagePayloadResponse) {}

rpc MessageContact (puppet.MessageContactRequest) returns (puppet.MessageContactResponse) {}
// @deprecated: using MessageFileStream to transfer files
rpc MessageFile (puppet.MessageFileRequest) returns (puppet.MessageFileResponse) {}
windmemory marked this conversation as resolved.
Show resolved Hide resolved
rpc MessageFileStream (puppet.MessageFileStreamRequest) returns (stream puppet.MessageFileStreamResponse) {}
// @deprecated: using MessageImageStream to transfer images
rpc MessageImage (puppet.MessageImageRequest) returns (puppet.MessageImageResponse) {}
windmemory marked this conversation as resolved.
Show resolved Hide resolved
rpc MessageImageStream (puppet.MessageImageStreamRequest) returns (stream puppet.MessageImageStreamResponse) {}
rpc MessageMiniProgram (puppet.MessageMiniProgramRequest) returns (puppet.MessageMiniProgramResponse) {}
rpc MessageUrl (puppet.MessageUrlRequest) returns (puppet.MessageUrlResponse) {}

Expand Down
15 changes: 15 additions & 0 deletions proto/wechaty/puppet/message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ message MessageImageResponse {
string filebox = 1;
}

message MessageImageStreamRequest {
string id = 1;
ImageType type = 2;
}
message MessageImageStreamResponse {
bytes data = 1;
}

message MessageContactRequest {
string id = 1;
}
Expand All @@ -70,6 +78,13 @@ message MessageFileResponse {
string filebox = 1;
}

message MessageFileStreamRequest {
string id = 1;
}
message MessageFileStreamResponse {
bytes data = 1;
}

message MessageMiniProgramRequest {
string id = 1;
}
Expand Down
10 changes: 10 additions & 0 deletions tests/puppet-server-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,22 @@ export const puppetServerImpl: IPuppetServer = {
throw new Error('not implemented.')
},

messageFileStream: (call) => {
void call
throw new Error('not implemented.')
},

messageImage: (call, callback) => {
void call
void callback
throw new Error('not implemented.')
},

messageImageStream: (call) => {
void call
throw new Error('not implemented.')
},

messageMiniProgram: (call, callback) => {
void call
void callback
Expand Down