GraphQLWsServer constructor
GraphQLWsServer(
- GraphQLWsClient client, {
- Duration? connectionInitWaitTimeout,
Starts serving client.
Implementation
GraphQLWsServer(this.client, {this.connectionInitWaitTimeout}) {
_sub = client.stream.listen(
_handle,
// A frame the protocol cannot read arrives here rather than as an
// exception nobody catches.
onError: (Object e) =>
_closeWith(GraphQLWsCloseCode.badRequest, e.toString()),
onDone: () => _close(),
);
final wait = connectionInitWaitTimeout;
if (wait != null) {
_initTimer = Timer(wait, () {
if (!_init) {
_closeWith(
GraphQLWsCloseCode.connectionInitialisationTimeout,
'Connection initialisation timeout',
);
}
});
}
}