Publishing

Publishing sends messages to Fanout subscribers. Fanout is designed to be GRIP-compatible, such that https://api.fastly.com/service/{service_id} can be used as a GRIP URL in application configurations.

HTTP response data model

Payload format for delivering to subscribers of whole HTTP responses (response hold mode). One of body or body-bin must be specified.

bodystringThe response body as a string.
body-binstringThe response body as a base64-encoded binary blob.
codeintegerThe HTTP status code. [Default 200]
headersobjectA map of arbitrary HTTP response headers to include in the response.
reasonstringThe HTTP status string. Defaults to a string appropriate for code.

HTTP stream data model

Payload format for delivering to subscribers of HTTP streaming response bodies (stream hold mode). One of content or content-bin must be specified.

contentstringA fragment of body data as a string.
content-binstringA fragment of body data as a base64-encoded binary blob.

Publish item (i.e., message) data model

An individual message.

channelstringThe channel to publish the message on.
formatsobjectTransport-specific message payload representations to be used for delivery. At least one format (http-response, http-stream, and/or ws-message) must be specified. Messages are only delivered to subscribers interested in the provided formats. For example, the ws-message format will only be sent to WebSocket clients.
idstringThe ID of the message.
prev-idstringThe ID of the previous message published on the same channel.

Publish data model

Contains a batch of messages to publish.

itemsarrayThe messages to publish.

WebSocket message data model

Payload format for delivering to subscribers of WebSocket messages. One of content or content-bin must be specified.

contentstringThe content of a WebSocket TEXT message.
content-binstringThe base64-encoded content of a WebSocket BINARY message.

Endpoints

Send messages to Fanout subscribers

POST/service/service_id/publish/

User contributed notes

BETA

Do you see an error in this page? Do have an interesting use case, example or edge case people should know about? Share your knowledge and help people who are reading this page! (Comments are moderated; for support, please contact support@fastly.com)