Open dchaofei opened 4 years ago
Thanks for asking this question, it's very important for us to understand the Wechaty architecture so that we can start designing our Go/Python/Java Wechaty code base.
Short answers to your questions:
Yes, our Go Wechaty should be backed by the
wechaty-puppet-hostie
(in Go of course), which will connect to the GRPC service as a client.
Yes.
wechaty-puppet-*
are all child class ofwechaty-puppet
abstract class, and anywechaty-puppet
class can be served as a GRPC service by the Wechaty framework.
As we already have a big picture from the whole Wechaty system from https://github.com/wechaty/wechaty/issues/1927 , lets zoom in and have a look on top of our GRPC service with our Go implementation:
+-------------------------------------------------------+
| |
| 1. Wechaty(Go, Python, Java) |
| |
+-------------------------------------------------------+
+-------------------------------------------------------+
| 2. Wechaty Puppet Abstract |
| |
| (wechaty-puppet) |
+-------------------------------------------------------+
+-------------------------------------------------------+
| 3. Wechaty Puppet Hostie |
| |
| (wechaty-puppet-hostie) |
+-------------------------------------------------------+
+------------------- 4. @chatie/grpc ----------------------+
Map to: TypeScript Wechaty
This is what we are doing in this repository.
Wechaty will provide all the APIs to the end-user, with underlying support from the puppet abstraction.
Map to: TypeScript Wechaty Puppet Abstraction
This is the puppet abstraction interface for Wechaty, which will help us to define the protocol between the Wechaty with all the different Puppet providers.
In Go/Python/Java, we only need to implement the wechaty-puppet-hostie
, which will connect our puppet abstraction to the GRPC service.
Note: It will be best if this module can be synced with the TypeScript abstraction automatically because:
We have already known a tool which can sync the data schemas from @suntong at #26
Map to: TypeScript Wechaty Puppet Hostie Client
A module with the name wechaty-puppet-hostie
is for implementing the puppet abstraction by connecting to our GRPC service from the Wechaty framework.
When we are working in Go, we can focus on the client-side because the server-side will be provided from the TypeScript ecosystem, which means we can be supported by all the Protocols from the powerful Wechaty Puppet Providers, like:
We already have our Go GRPC module at https://github.com/wechaty/go-grpc today (appreciate for your PR), and it will be automatically updated with the version tag whenever our chatie/grpc repo updated.
The Wechaty API should be implemented first, then the Wechaty Puppet Abstraction API second.
After we have both Wechaty API and Puppet Abstraction, then we can build our Wechaty Puppett Hostie Client based on them.
I hope my explanation will be helpful, please feel free to let me know if you have any questions.
Thank you for your answer.
Cross-post from https://github.com/wechaty/go-wechaty/pull/32#discussion_r411117676
I believe we should make the import chain rule more clearer: the wechaty-puppet-hostie
should rely as much as possible on the github.com/wechaty/go-wechaty/wechaty-puppet
and github.com/wechaty/go-grpc
because they have different responsibilities.
wechaty-puppet-hostie
should implement the interface from github.com/wechaty/go-wechaty/wechaty-puppet
, and connect those API from the interface, to the grpc service via github.com/wechaty/go-grpc
github.com/wechaty/go-wechaty/wechaty-puppet
should only define an interface for all puppets. (A Abstract Class in OOP, a Protocol in ObjC, or Interface in Go(?))github.com/wechaty/go-grpc
should be auto-generated from the protocol buffer, so that it can provide the Go API interface directly to our puppet provider.
Question 1: Is wechaty-puppet-hostie acting as a client? Wechaty-puppet- * can be connected via wechaty-puppet-hostie?