Skip to content

Latest commit

 

History

History
214 lines (126 loc) · 5.69 KB

File metadata and controls

214 lines (126 loc) · 5.69 KB

graphql-lambda-subscriptions / ServerArgs

Interface: ServerArgs

Table of contents

Properties

Properties

apiGatewayManagementApi

Optional apiGatewayManagementApi: MaybePromise<ApiGatewayManagementApiSubset>

An optional ApiGatewayManagementApi object


context

Optional context: object | (arg: { complete: (event: { payload?: Record<string, any> ; topic: string }) => Promise<void> ; connectionId: string ; connectionInitPayload: any ; publish: (event: { payload: Record<string, any> ; topic: string }) => Promise<void> }) => MaybePromise<object>

Makes the context object for all operations defaults to { connectionInitPayload, connectionId }


dynamodb

dynamodb: MaybePromise<DynamoDB>


log

Optional log: LoggerFunction

Defaults to debug('graphql-lambda-subscriptions') from https://www.npmjs.com/package/debug


onConnect

Optional onConnect: (e: { event: APIGatewayWebSocketEvent }) => MaybePromise<void>

Type declaration

▸ (e): MaybePromise<void>

Parameters
Name Type
e Object
e.event APIGatewayWebSocketEvent
Returns

MaybePromise<void>


onConnectionInit

Optional onConnectionInit: (e: { event: APIGatewayWebSocketEvent ; message: ConnectionInitMessage }) => MaybePromise<Record<string, any>>

Type declaration

▸ (e): MaybePromise<Record<string, any>>

Parameters
Name Type
e Object
e.event APIGatewayWebSocketEvent
e.message ConnectionInitMessage
Returns

MaybePromise<Record<string, any>>


onDisconnect

Optional onDisconnect: (e: { event: APIGatewayWebSocketEvent }) => MaybePromise<void>

Type declaration

▸ (e): MaybePromise<void>

Parameters
Name Type
e Object
e.event APIGatewayWebSocketEvent
Returns

MaybePromise<void>


onError

Optional onError: (error: any, context: any) => MaybePromise<void>

Type declaration

▸ (error, context): MaybePromise<void>

Parameters
Name Type
error any
context any
Returns

MaybePromise<void>


onPing

Optional onPing: (e: { event: APIGatewayWebSocketEvent ; message: PingMessage }) => MaybePromise<void>

Type declaration

▸ (e): MaybePromise<void>

Parameters
Name Type
e Object
e.event APIGatewayWebSocketEvent
e.message PingMessage
Returns

MaybePromise<void>


onPong

Optional onPong: (e: { event: APIGatewayWebSocketEvent ; message: PongMessage }) => MaybePromise<void>

Type declaration

▸ (e): MaybePromise<void>

Parameters
Name Type
e Object
e.event APIGatewayWebSocketEvent
e.message PongMessage
Returns

MaybePromise<void>


pingpong

Optional pingpong: MaybePromise<{ delay: number ; machine: string ; timeout: number }>

If set you can use the stepFunctionsHandler and a step function to setup a per connection ping/pong cycle to detect disconnects sooner than the 10 minute idle timeout.


schema

schema: GraphQLSchema

A GraphQL Schema with resolvers

You can use makeExecutableSchema from @graphql-tools/schema, or makeSchema from nexus

import { makeExecutableSchema } from '@graphql-tools/schema
// or
import { makeSchema } from 'nexus'

tableNames

Optional tableNames: MaybePromise<{ connections?: string ; subscriptions?: string }>

An optional object or a promise for an object with DDB table names.

Defaults to { connections: 'graphql_connections', subscriptions: 'graphql_subscriptions' }