Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Commit

Permalink
doc: update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
DxCx committed Sep 14, 2017
1 parent df6d3cb commit 5d13c9c
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,16 +225,12 @@ ReactDOM.render(
- `webSocketImpl?: Object` - optional, WebSocket implementation. use this when your environment does not have a built-in native WebSocket (for example, with NodeJS client)

### Methods
#### `subscribe(options, handler) => number`: returns the operation id that identifies the operation
- `options: {SubscriptionOptions}`
#### `request(options) => Observable<ExecutionResult>`: returns observable to execute the operation.
- `options: {OperationOptions}`
* `query: string` : GraphQL subscription
* `variables: Object` : GraphQL subscription variables
* `operationName: string` : operation name of the subscription
* `context: Object` : use to override context for a specific call
- `handler: (errors: Error[], result?: any) => void` : function to handle any errors and results from the subscription response

#### `unsubscribe(id) => void` - unsubscribes from a specific subscription
- `id: string` : the subscription ID of the subscription to unsubscribe from

#### `unsubscribeAll() => void` - unsubscribes from all active subscriptions.

Expand Down Expand Up @@ -269,13 +265,6 @@ ReactDOM.render(
- `thisContext: any`: `this` context to use when calling the callback function.
- => Returns an `off` method to cancel the event subscription.

### `query(options: OperationOptions) => Promise<ExecutionResult>` : Executes GraphQL operation over the WebSocket
- `options: OperationOptions`:
* `query: string` - GraphQL operation as string or parsed GraphQL document node
* `variables?: Object` - Object with GraphQL variables
* `operationName?: string` - GraphQL operation name
* `context?: any` - Execution context for the operation

### `close() => void` - closes the WebSocket connection manually, and ignores `reconnect` logic if it was set to `true`.

### `use(middlewares: MiddlewareInterface[]) => SubscriptionClient` - adds middleware to modify `OperationOptions` per each request
Expand All @@ -290,7 +279,7 @@ ReactDOM.render(
* `rootValue?: any` : Root value to use when executing GraphQL root operations
* `schema?: GraphQLSchema` : GraphQL schema object
* `execute?: (schema, document, rootValue, contextValue, variableValues, operationName) => Promise<ExecutionResult> | AsyncIterator<ExecutionResult>` : GraphQL `execute` function, provide the default one from `graphql` package. Return value of `AsyncItrator` is also valid since this package also support reactive `execute` methods.
* `subscribe?: (schema, document, rootValue, contextValue, variableValues, operationName) => Promise<AsyncIterator<ExecutionResult>>` : GraphQL `subscribe` function, provide the default one from `graphql` package.
* `subscribe?: (schema, document, rootValue, contextValue, variableValues, operationName) => Promise<ExecutionResult | AsyncIterator<ExecutionResult>>` : GraphQL `subscribe` function, provide the default one from `graphql` package.
* `onOperation?: (message: SubscribeMessage, params: SubscriptionOptions, webSocket: WebSocket)` : optional method to create custom params that will be used when resolving this operation
* `onOperationComplete?: (webSocket: WebSocket, opId: string)` : optional method that called when a GraphQL operation is done (for query and mutation it's immeditaly, and for subscriptions when unsubscribing)
* `onConnect?: (connectionParams: Object, webSocket: WebSocket)` : optional method that called when a client connects to the socket, called with the `connectionParams` from the client, if the return value is an object, its elements will be added to the context. return `false` or throw an exception to reject the connection. May return a Promise.
Expand Down

0 comments on commit 5d13c9c

Please sign in to comment.