diff options
author | Loïc Hoguin <[email protected]> | 2024-01-17 12:52:45 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2024-01-17 12:52:45 +0100 |
commit | 5fe1be70078d7970c9e3bb687294d438918d7925 (patch) | |
tree | 3f0219d2fe307aaf75401401c4978a79597b9da0 /doc/src/manual/cowboy_stream.info.asciidoc | |
parent | defce46fdf85d16bbe3c0a8de6058334e8a53775 (diff) | |
download | cowboy-5fe1be70078d7970c9e3bb687294d438918d7925.tar.gz cowboy-5fe1be70078d7970c9e3bb687294d438918d7925.tar.bz2 cowboy-5fe1be70078d7970c9e3bb687294d438918d7925.zip |
Add missing manual pages for cowboy_stream functions
Diffstat (limited to 'doc/src/manual/cowboy_stream.info.asciidoc')
-rw-r--r-- | doc/src/manual/cowboy_stream.info.asciidoc | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/doc/src/manual/cowboy_stream.info.asciidoc b/doc/src/manual/cowboy_stream.info.asciidoc new file mode 100644 index 0000000..32cbd85 --- /dev/null +++ b/doc/src/manual/cowboy_stream.info.asciidoc @@ -0,0 +1,77 @@ += cowboy_stream:info(3) + +== Name + +cowboy_stream:info - Handle a message for a stream + +== Description + +[source,erlang] +---- +info(StreamID, Info, State) -> {Commands, State} + +StreamID :: cowboy_stream:stream_id() +Info :: any() +Commands :: cowboy_stream:commands() +State - opaque +---- + +Handle a message for a stream. + +This function should be called by all stream handlers. It will +propagate the event to the next configured stream handler. +Handlers do not have to propagate events that have been +fully handled. + +== Arguments + +StreamID:: + +The stream ID. + +Info:: + +The event received. + +Commands:: + +The commands to be executed. + +State:: + +The state for the next stream handler. + +== Return value + +A list of commands and an opaque state is returned. + +The list of commands returned should be included in the +commands returned from the current stream handler. It +can be modified if necessary. + +The state should be stored in the current stream +handler's state and passed to `cowboy_stream` when +necessary. The state should be treated as opaque. + +== Changelog + +* *2.0*: Function introduced. + +== Examples + +.Propagate an event to the next stream handler +[source,erlang] +---- +info(StreamID, Info, State=#state{next=Next0}) -> + MyCommands = my_commands(), + {Commands, Next} = cowboy_stream:info(StreamID, Info, Next0), + {MyCommands ++ Commands, #state{next=Next}}. +---- + +== See also + +link:man:cowboy_stream(3)[cowboy_stream(3)], +link:man:cowboy_stream:init(3)[cowboy_stream:init(3)], +link:man:cowboy_stream:data(3)[cowboy_stream:data(3)], +link:man:cowboy_stream:terminate(3)[cowboy_stream:terminate(3)], +link:man:cowboy_stream:early_error(3)[cowboy_stream:early_error(3)] |