Skip to content

Commit

Permalink
docs(protocol): more auth options [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
enisdenjo committed Oct 31, 2020
1 parent 99d05dc commit fb2ab09
Showing 1 changed file with 1 addition and 26 deletions.
27 changes: 1 addition & 26 deletions PROTOCOL.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,11 @@ interface ConnectionInitMessage {
}
```

The server will respond by either:

- Dispatching a `ConnectionAck` message acknowledging that the connection has been successfully established.
- Closing the socket with a close event `4403: Forbidden` indicating that the connection request has been denied because of access control.
- Closing the socket with a close event `4400: <error-message>` indicating that the connection request has been denied because of an implementation specific error.

### `ConnectionAck`

Direction: **Server -> Client**

Potential response to the `ConnectionInit` message from the client acknowledging a successful connection with the server.
Expected response to the `ConnectionInit` message from the client acknowledging a successful connection with the server.

```typescript
interface ConnectionAckMessage {
Expand Down Expand Up @@ -148,24 +142,6 @@ For the sake of clarity, the following examples demonstrate the communication pr
1. _Server_ validates the connection initialisation request and dispatches a `ConnectionAck` message to the client on successful connection
1. _Client_ has received the acknowledgement message and is now ready to request operation executions

### Forbidden connection initialisation

1. _Client_ sends a WebSocket handshake request with the sub-protocol: `graphql-transport-ws`
1. _Server_ accepts the handshake and establishes a WebSocket communication channel (which we call "socket")
1. _Client_ immediately dispatches a `ConnectionInit` message optionally providing a payload as agreed with the server
1. _Server_ validates the connection initialisation request and decides that the client is not allowed to establish a connection
1. _Server_ closes the socket by dispatching the event `4403: Forbidden`
1. _Client_ reports an error using the close event reason (which is `Forbidden`)

### Erroneous connection initialisation

1. _Client_ sends a WebSocket handshake request with the sub-protocol: `graphql-transport-ws`
1. _Server_ accepts the handshake and establishes a WebSocket communication channel (which we call "socket")
1. _Client_ immediately dispatches a `ConnectionInit` message optionally providing a payload as agreed with the server
1. _Server_ tries validating the connection initialisation request but an error `I'm a teapot` is thrown
1. _Server_ closes the socket by dispatching the event `4400: I'm a teapot`
1. _Client_ reports an error using the close event reason (which is `I'm a teapot`)

### Connection initialisation timeout

1. _Client_ sends a WebSocket handshake request with the sub-protocol: `graphql-transport-ws`
Expand All @@ -174,7 +150,6 @@ For the sake of clarity, the following examples demonstrate the communication pr
1. _Server_ waits for the `ConnectionInit` message for the duration specified in the `connectionInitWaitTimeout` parameter
1. _Server_ waiting time has passed
1. _Server_ closes the socket by dispatching the event `4408: Connection initialisation timeout`
1. _Client_ reports an error using the close event reason (which is `Connection initialisation timeout`)

### Single result operation

Expand Down

0 comments on commit fb2ab09

Please sign in to comment.