MessageStart
Description
Event to mark the start of a message in an event stream.
It can also hold the high-level representation for the header of the message in its head property.
The content of head can vary according to the protocol being used. See For each protocol.
Constructor
new MessageStart(head?)
Creates an instance of MessageStart.
Properties
headProtocol-dependent message header.
Type of the event.
Example
This example could be done more concisely with a Message object.
pipy().listen(8080).demuxHTTP().to($=>$.replaceMessage([// This can also be done with a single Message object.new MessageStart({status: 200,statusText: 'OK',headers: {'content-type': 'text/plain'}}),new Data('Hello!\n'),new MessageEnd,]))