Server Smalltalk Guide
-
- To better understand this section, examine the samples
SstHttpClientExample and SstHttpServerExample.
Message assemblers are pluggable transport elements which define
the transport's wire format and protocol. For example, rather than
requiring you to hand build HTTP messages, the HTTP message assembler takes in
an abstract description of an HTTP request and converts it to a series of
bytes which it then sends using the transport's mechanisms.
Similarly, transports such as SMTP require several interactions between
sender and receiver to transmit one logical message. Message assemblers
encode this behavior.
Assemblers can be used to coordinate with higher-level notions of sending
and receiving. For example, the HTTP assembler allows the contents of
an outgoing message to be a Block. When the assembler goes
to output the contents, rather than writing it to the TCP socket it evaluates
the block and supplies a stream as an argument. Using this mechanism,
you can send large messages--such as files--efficiently and effect
the lazy creation of message content.
The basic protocol for message assemblers is outlined below:
- assembleFrom: input
- Assembles or retrieves a communication message from
@input. This may require some protocol negotiation across
the transport mechanism. @input may be streaming, in which
case standard stream protocol can be used to send and receive bytes.
- disassembleReply: message
onto: output
- Disassembles or breaks down @message, a communication message,
into a form suitable to sent as a reply onto @output. This
may require some protocol negotiation across the transport mechanism.
@output may be streaming, in which case standard stream protocol
can be used to send and receive bytes.
- disassembleSend: message
onto: output
- Disassembles or breaks down @message, a communication message,
into a form suitable to sent as onto @output. This may
require some protocol negotiation across the transport mechanism.
@output may be streaming, in which case standard stream protocol
can be used to send and receive bytes.
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]