Configuration.detectProtocol()
Description
Appends a detectProtocol filter to the current pipeline layout.
A detectProtocol filter calls a user function to notify what protocol the input Data stream is.
- INPUT - Data stream to detect protocol for.
- OUTPUT - The same Data stream as input.
The user function that gets called will have a string as parameter, which can be:
- "TLS" if a TLS stream is detected
- "HTTP" if a plain HTTP/1.0 or HTTP/1.1 stream is detected
- "HTTP2" if a plain HTTP/2 stream is detected
- "" (empty string) if the stream is concluded to be none of the above protocols
This filter passes everything down unaltered. It doesn't change anything in the event stream.
Syntax
pipy().pipeline().detectProtocol((protocolName) => onProtocolDetected(protocolName))
Parameters
detectProtocol(handler)
handler
A function that receives the detected protocol. Its parameter can be "TLS" or "HTTP". When no known protocols can be detected, it receives "".
Return Value
The same Configuration object.