MessageStart.head
Description
Protocol-dependent message header.
For each protocol
The content of head can vary depending on the protocol used by the message.
HTTP
The head of an HTTP request message has the following content:
- scheme - For HTTP/2 only, "http" or "https"
- authority - Equivalent to the Host header in HTTP/2
- protocol - Can be "HTTP/1.0" or "HTTP/1.1"
- method - HTTP method such as "GET" and "POST"
- path - Requested URI
- headers - Header fields
The head of an HTTP response message has the following content:
- protocol - Can be "HTTP/1.0" or "HTTP/1.1"
- status - Response status code
- statusText - Response reason phrase
- headers - Header fields
MQTT
The head of an MQTT packet has the following content:
- type - Type of the packet such as "SUBSCRIBE" and "PUBLISH"
- qos - PUBLISH Quality of Service
- dup - Duplicate delivery of a PUBLISH packet
- retain - PUBLISH retained message flag
- Other properties defined in the specification
Thrift
The head of a Thrift message has the following content:
- seqID - Sequence ID as a number
- type - Type of the message: "call", "reply", "exception" or "oneway"
- name - Name of the message
- protocol - Encoding protocol: "binary" or "compact"
Dubbo
The head of a Dubbo message has the following content:
- id - Request ID as a string
- status - Status code
- isRequest - Is it a request?
- isTwoWay - Is it 2-way?
- isEvent - Is it an event?
Syntax
messageStart.head
Example
pipy().listen(8080).demuxHTTP().to($=>$.handleMessageStart(msg => (console.log('Path:', msg.head.path, 'Headers:', msg.head.headers))).replaceMessage(new Message('Hello!')))