what tigger HTTPProtocol on_message_complete?
Do you mean this?
https://github.com/channelcat/sanic/blob/79df52e519588112e43dd771dcd42ea245e732d2/sanic/server.py#L283
The HTTPProtocol is a subclass/extension of the asyncio.Protocol class. It is passed to the asyncio TCP socket data handler to act as the receiving protocol implementation.
It is the asyncio TCP service (in the case of Sanic, it is the one provided by uvloop) that calls on_message_complete after all packets of the TCP message has been received by the socket.
@GzRichChen "on_message_complete" is a callback from HttpRequestParser (httptools library). It's triggered after the HTTP parser consumes all the HTTP request body (Sanic will feed the HTTP parser as data is received from asyncio). @ashleysommer your answer is wrong.
Most helpful comment
@GzRichChen "on_message_complete" is a callback from HttpRequestParser (httptools library). It's triggered after the HTTP parser consumes all the HTTP request body (Sanic will feed the HTTP parser as data is received from asyncio). @ashleysommer your answer is wrong.