| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
WARNING: We're working on this 💪. For discussion purposes only at this moment.
The simplest way to describe protocols for peer-to-peer and client to server communication via GraphQL interfaces, built for the social protocol family.
Basically, a repository of common GraphQL service interfaces for everyone to implement. Think 'services' as WSDL that defines how servers or servers-to-client can communicate to each other via a common GraphQL interface. The core idea is that a server can simply request what protocols (interfaces) a GraphQL server implements and can start communicating with that server if it supports that queried protocol.
It solves the rules of engagement and lack of standardization on how server-to-server or clients should talk to eachother and therefore enhancing interoperability for the open web. It makes data and operations on it interchangable.
An example; there are 20 domain name registrars where you can buy domain names and automating registering domains would require implementing 20 specific APIs. What if there would be just one simple interface that allows you to talk with all these registars?
With the help of GraphQL protocols, one could define a single interface that all registrars would need to implement. This way you could build a registration client allowing to register at those vendors easily. That's the aim of GraphQL protocols. Making it easy to build interfaces for distributed services.
The same goes for an notifcation service. You define the protocol and the resulting notification implementation can differ from Slack to email as long as you adhere to the GraphQL SDL protocol, the resulting consumers won't break either.
Some other usecases where GraphQL protocols would shine:
GraphQL is a simple concept for humans and machines. It is elegant and the SDL is descriptive, inuitive, shareable, and easy to and implement.
And of course the benefits of GraphQL itself, such as:
All of the protocols are currently in DRAFT state and used as input for discussion.
The protocols are just Plain Old GraphQL Interfaces written in SDL. Servers and clients need to implement these interfaces and types to talk with each other. GraphQL protocols are a best practice pattern rather than an actual technical solution.
Usually, such a protocol exists out of a couple of parts defined in the GraphQL schema definition. For example, let's say you have a bunch of servers that send messages to each other. By connecting to a server that supports this protocol, you can easily send a message to the owner of that protocol.
The types you need for your service (You will share this file with your implementers):
# The type you need for your service
type Message {
message: String
}
# The query interface
interface Postbox {
messages: [Message]
}
# The mutation interface
interface PostboxMutatations {
postMessage(message: String): Message
}Then you need to hook them up to your query type.
Add to your query type:
type Query implements PostboxAdd to your mutation types:
type Mutation implements PostboxMutatationsAnd that's it. The idea is that the protocol part is reusable. And that other implementers only need to implement your interface SDL for clients to talk to.
This will help you building protocols that are easy to maintain.
Keep your protocols as easy and small as possible. The chances that complicated protocols will get implemented are quite small. The easier to implement, the higher chances of adoption.
Fork this repo, use the template and raise a PR.
| Back | FazBrowse Home | New Git URL |