graphql-lambda-subscriptions / ServerArgs
- apiGatewayManagementApi
- context
- dynamodb
- log
- onConnect
- onConnectionInit
- onDisconnect
- onError
- onPing
- onPong
- pingpong
- schema
- tableNames
• Optional
apiGatewayManagementApi: MaybePromise
<ApiGatewayManagementApiSubset
>
An optional ApiGatewayManagementApi object
• 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: MaybePromise
<DynamoDB
>
• Optional
log: LoggerFunction
Defaults to debug('graphql-lambda-subscriptions') from https://www.npmjs.com/package/debug
• Optional
onConnect: (e
: { event
: APIGatewayWebSocketEvent
}) => MaybePromise
<void
>
▸ (e
): MaybePromise
<void
>
Name | Type |
---|---|
e |
Object |
e.event |
APIGatewayWebSocketEvent |
MaybePromise
<void
>
• Optional
onConnectionInit: (e
: { event
: APIGatewayWebSocketEvent
; message
: ConnectionInitMessage
}) => MaybePromise
<Record
<string
, any
>>
▸ (e
): MaybePromise
<Record
<string
, any
>>
Name | Type |
---|---|
e |
Object |
e.event |
APIGatewayWebSocketEvent |
e.message |
ConnectionInitMessage |
MaybePromise
<Record
<string
, any
>>
• Optional
onDisconnect: (e
: { event
: APIGatewayWebSocketEvent
}) => MaybePromise
<void
>
▸ (e
): MaybePromise
<void
>
Name | Type |
---|---|
e |
Object |
e.event |
APIGatewayWebSocketEvent |
MaybePromise
<void
>
• Optional
onError: (error
: any
, context
: any
) => MaybePromise
<void
>
▸ (error
, context
): MaybePromise
<void
>
Name | Type |
---|---|
error |
any |
context |
any |
MaybePromise
<void
>
• Optional
onPing: (e
: { event
: APIGatewayWebSocketEvent
; message
: PingMessage
}) => MaybePromise
<void
>
▸ (e
): MaybePromise
<void
>
Name | Type |
---|---|
e |
Object |
e.event |
APIGatewayWebSocketEvent |
e.message |
PingMessage |
MaybePromise
<void
>
• Optional
onPong: (e
: { event
: APIGatewayWebSocketEvent
; message
: PongMessage
}) => MaybePromise
<void
>
▸ (e
): MaybePromise
<void
>
Name | Type |
---|---|
e |
Object |
e.event |
APIGatewayWebSocketEvent |
e.message |
PongMessage |
MaybePromise
<void
>
• 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: 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'
• 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' }