| 1 |
= cowboy_stream:terminate(3) |
| 2 |
|
| 3 |
== Name |
| 4 |
|
| 5 |
cowboy_stream:terminate - Terminate a stream |
| 6 |
|
| 7 |
== Description |
| 8 |
|
| 9 |
[source,erlang] |
| 10 |
---- |
| 11 |
terminate(StreamID, Reason, State) -> ok |
| 12 |
|
| 13 |
StreamID :: cowboy_stream:stream_id() |
| 14 |
Reason :: cowboy_stream:reason() |
| 15 |
State - opaque |
| 16 |
---- |
| 17 |
|
| 18 |
Terminate a stream. |
| 19 |
|
| 20 |
This function must be called by all stream handlers. It will |
| 21 |
terminate the next configured stream handler. |
| 22 |
|
| 23 |
== Arguments |
| 24 |
|
| 25 |
StreamID:: |
| 26 |
|
| 27 |
The stream ID. |
| 28 |
|
| 29 |
Reason:: |
| 30 |
|
| 31 |
Reason for termination. |
| 32 |
|
| 33 |
State:: |
| 34 |
|
| 35 |
The state for the next stream handler. |
| 36 |
|
| 37 |
== Return value |
| 38 |
|
| 39 |
The atom `ok` is always returned. It can be safely ignored. |
| 40 |
|
| 41 |
== Changelog |
| 42 |
|
| 43 |
* *2.0*: Function introduced. |
| 44 |
|
| 45 |
== Examples |
| 46 |
|
| 47 |
.Terminate the next stream handler |
| 48 |
[source,erlang] |
| 49 |
---- |
| 50 |
terminate(StreamID, Reason, State=#state{next=Next0}) -> |
| 51 |
my_termination(State), |
| 52 |
cowboy_stream:terminate(StreamID, Reason, Next0). |
| 53 |
---- |
| 54 |
|
| 55 |
== See also |
| 56 |
|
| 57 |
link:man:cowboy_stream(3)[cowboy_stream(3)], |
| 58 |
link:man:cowboy_stream:init(3)[cowboy_stream:init(3)], |
| 59 |
link:man:cowboy_stream:data(3)[cowboy_stream:data(3)], |
| 60 |
link:man:cowboy_stream:info(3)[cowboy_stream:info(3)], |
| 61 |
link:man:cowboy_stream:early_error(3)[cowboy_stream:early_error(3)] |