This function receives as many frames as possible until the user
callback Connector.read returns ErrorCode.WOULDBLOCK.
This function calls several Connector functions which are passed
when initializing the Session.
Here is the simple time chart which tells when each callback is invoked:
1. Connector.read is invoked one or more times to receive the frame header.
2. Connector.onFrame may be invoked if one DATA frame is completely received.
3. Connector.onStreamExit may be invoked if the reception of the frame triggers
closure of the stream.
4. If the frame is the control frame:
1. Connector.read is invoked one or more times to receive the whole frame.
2. If the received frame is valid, then following actions are
taken.
- If the frame is either HEADERS or PUSH_PROMISE:
- Connector.onHeaders is invoked first.
- Connector.onHeaderField is invoked for each header fields.
- Connector.onFrame is invoked after all header fields.
- For other frames:
- Connector.onFrame is invoked.
- Connector.onStreamExit may be invoked if the reception of the frame
triggers the closure of the stream.
3. Connector.onInvalidFrame may be invoked if the received frame is unpacked
but is interpreted as invalid.
This function returns 0 if it succeeds, or one of the following
negative error codes:
ErrorCode.EOF
The remote peer did shutdown on the connection.
ErrorCode.CALLBACK_FAILURE
The callback function failed.
ErrorCode.BAD_PREFACE
Invalid client preface was detected. This error only returns
when Session was configured as server and
setRecvClientPreface() is used.
Receives frames from the remote peer.
This function receives as many frames as possible until the user callback Connector.read returns ErrorCode.WOULDBLOCK. This function calls several Connector functions which are passed when initializing the Session.
Here is the simple time chart which tells when each callback is invoked:
1. Connector.read is invoked one or more times to receive the frame header.
2. Connector.onFrameHeader is invoked after the frame header is received.
3. If the frame is DATA frame:
1. Connector.read is invoked one or more times to receive the DATA payload.
2. Connector.onDataChunk is invoked alternatively with Connector.read for each chunk of data.
2. Connector.onFrame may be invoked if one DATA frame is completely received.
3. Connector.onStreamExit may be invoked if the reception of the frame triggers closure of the stream.
4. If the frame is the control frame:
1. Connector.read is invoked one or more times to receive the whole frame.
2. If the received frame is valid, then following actions are taken. - If the frame is either HEADERS or PUSH_PROMISE: - Connector.onHeaders is invoked first. - Connector.onHeaderField is invoked for each header fields. - Connector.onFrame is invoked after all header fields. - For other frames: - Connector.onFrame is invoked. - Connector.onStreamExit may be invoked if the reception of the frame triggers the closure of the stream.
3. Connector.onInvalidFrame may be invoked if the received frame is unpacked but is interpreted as invalid.
This function returns 0 if it succeeds, or one of the following negative error codes:
ErrorCode.EOF The remote peer did shutdown on the connection. ErrorCode.CALLBACK_FAILURE The callback function failed. ErrorCode.BAD_PREFACE Invalid client preface was detected. This error only returns when Session was configured as server and setRecvClientPreface() is used.