TransportWSServer constructor
TransportWSServer(})
Implementation
TransportWSServer(
this.channel, {
required this.close,
this.connectionInitWaitTimeout = const Duration(seconds: 3),
this.keepAliveInterval,
}) {
_initTimer = Timer(connectionInitWaitTimeout, () {
if (!_initReceived) {
_closeWith(
TransportWSCloseCode.connectionInitialisationTimeout,
'Connection initialisation timeout',
);
}
});
_subscription = channel.stream.listen(
_onText,
// An error, such as a binary message, is an invalid message: the
// connection is closed, rather than kept open unanswered.
onError: (_) =>
_closeWith(TransportWSCloseCode.badRequest, 'Invalid message'),
onDone: _end,
);
}