mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Document stopping the listener in App:stop/1
This commit is contained in:
parent
e4a535cfa6
commit
99df823cc3
16 changed files with 29 additions and 16 deletions
|
@ -75,7 +75,7 @@ start(_Type, _Args) ->
|
||||||
Dispatch = cowboy_router:compile([
|
Dispatch = cowboy_router:compile([
|
||||||
{'_', [{"/", hello_handler, []}]}
|
{'_', [{"/", hello_handler, []}]}
|
||||||
]),
|
]),
|
||||||
{ok, _} = cowboy:start_tls(my_http_listener,
|
{ok, _} = cowboy:start_tls(my_https_listener,
|
||||||
[
|
[
|
||||||
{port, 8443},
|
{port, 8443},
|
||||||
{certfile, "/path/to/certfile"},
|
{certfile, "/path/to/certfile"},
|
||||||
|
@ -101,6 +101,19 @@ Cowboy 2.0 gets released.
|
||||||
Compatibility with HTTP/1.0 is provided by Cowboy's HTTP/1.1
|
Compatibility with HTTP/1.0 is provided by Cowboy's HTTP/1.1
|
||||||
implementation.
|
implementation.
|
||||||
|
|
||||||
|
=== Stopping the listener
|
||||||
|
|
||||||
|
When starting listeners along with the application it is
|
||||||
|
a good idea to also stop the listener when the application
|
||||||
|
stops. This can be done by calling `cowboy:stop_listener/1`
|
||||||
|
in the application's stop function:
|
||||||
|
|
||||||
|
[source,erlang]
|
||||||
|
----
|
||||||
|
stop(_State) ->
|
||||||
|
ok = cowboy:stop_listener(my_http_listener).
|
||||||
|
----
|
||||||
|
|
||||||
=== Protocol configuration
|
=== Protocol configuration
|
||||||
|
|
||||||
The HTTP/1.1 and HTTP/2 protocols share the same semantics;
|
The HTTP/1.1 and HTTP/2 protocols share the same semantics;
|
||||||
|
|
|
@ -22,4 +22,4 @@ start(_Type, _Args) ->
|
||||||
chunked_hello_world_sup:start_link().
|
chunked_hello_world_sup:start_link().
|
||||||
|
|
||||||
stop(_State) ->
|
stop(_State) ->
|
||||||
ok.
|
ok = cowboy:stop_listener(http).
|
||||||
|
|
|
@ -23,4 +23,4 @@ start(_Type, _Args) ->
|
||||||
compress_response_sup:start_link().
|
compress_response_sup:start_link().
|
||||||
|
|
||||||
stop(_State) ->
|
stop(_State) ->
|
||||||
ok.
|
ok = cowboy:stop_listener(http).
|
||||||
|
|
|
@ -22,4 +22,4 @@ start(_Type, _Args) ->
|
||||||
cookie_sup:start_link().
|
cookie_sup:start_link().
|
||||||
|
|
||||||
stop(_State) ->
|
stop(_State) ->
|
||||||
ok.
|
ok = cowboy:stop_listener(http).
|
||||||
|
|
|
@ -22,4 +22,4 @@ start(_Type, _Args) ->
|
||||||
echo_get_sup:start_link().
|
echo_get_sup:start_link().
|
||||||
|
|
||||||
stop(_State) ->
|
stop(_State) ->
|
||||||
ok.
|
ok = cowboy:stop_listener(http).
|
||||||
|
|
|
@ -22,4 +22,4 @@ start(_Type, _Args) ->
|
||||||
echo_post_sup:start_link().
|
echo_post_sup:start_link().
|
||||||
|
|
||||||
stop(_State) ->
|
stop(_State) ->
|
||||||
ok.
|
ok = cowboy:stop_listener(http).
|
||||||
|
|
|
@ -23,4 +23,4 @@ start(_Type, _Args) ->
|
||||||
eventsource_sup:start_link().
|
eventsource_sup:start_link().
|
||||||
|
|
||||||
stop(_State) ->
|
stop(_State) ->
|
||||||
ok.
|
ok = cowboy:stop_listener(http).
|
||||||
|
|
|
@ -26,4 +26,4 @@ start(_Type, _Args) ->
|
||||||
file_server_sup:start_link().
|
file_server_sup:start_link().
|
||||||
|
|
||||||
stop(_State) ->
|
stop(_State) ->
|
||||||
ok.
|
ok = cowboy:stop_listener(http).
|
||||||
|
|
|
@ -22,4 +22,4 @@ start(_Type, _Args) ->
|
||||||
hello_world_sup:start_link().
|
hello_world_sup:start_link().
|
||||||
|
|
||||||
stop(_State) ->
|
stop(_State) ->
|
||||||
ok.
|
ok = cowboy:stop_listener(http).
|
||||||
|
|
|
@ -23,4 +23,4 @@ start(_Type, _Args) ->
|
||||||
markdown_middleware_sup:start_link().
|
markdown_middleware_sup:start_link().
|
||||||
|
|
||||||
stop(_State) ->
|
stop(_State) ->
|
||||||
ok.
|
ok = cowboy:stop_listener(http).
|
||||||
|
|
|
@ -22,4 +22,4 @@ start(_Type, _Args) ->
|
||||||
rest_basic_auth_sup:start_link().
|
rest_basic_auth_sup:start_link().
|
||||||
|
|
||||||
stop(_State) ->
|
stop(_State) ->
|
||||||
ok.
|
ok = cowboy:stop_listener(http).
|
||||||
|
|
|
@ -22,4 +22,4 @@ start(_Type, _Args) ->
|
||||||
rest_hello_world_sup:start_link().
|
rest_hello_world_sup:start_link().
|
||||||
|
|
||||||
stop(_State) ->
|
stop(_State) ->
|
||||||
ok.
|
ok = cowboy:stop_listener(http).
|
||||||
|
|
|
@ -22,4 +22,4 @@ start(_Type, _Args) ->
|
||||||
rest_pastebin_sup:start_link().
|
rest_pastebin_sup:start_link().
|
||||||
|
|
||||||
stop(_State) ->
|
stop(_State) ->
|
||||||
ok.
|
ok = cowboy:stop_listener(http).
|
||||||
|
|
|
@ -26,4 +26,4 @@ start(_Type, _Args) ->
|
||||||
ssl_hello_world_sup:start_link().
|
ssl_hello_world_sup:start_link().
|
||||||
|
|
||||||
stop(_State) ->
|
stop(_State) ->
|
||||||
ok.
|
ok = cowboy:stop_listener(https).
|
||||||
|
|
|
@ -22,4 +22,4 @@ start(_Type, _Args) ->
|
||||||
upload_sup:start_link().
|
upload_sup:start_link().
|
||||||
|
|
||||||
stop(_State) ->
|
stop(_State) ->
|
||||||
ok.
|
ok = cowboy:stop_listener(http).
|
||||||
|
|
|
@ -23,4 +23,4 @@ start(_Type, _Args) ->
|
||||||
websocket_sup:start_link().
|
websocket_sup:start_link().
|
||||||
|
|
||||||
stop(_State) ->
|
stop(_State) ->
|
||||||
ok.
|
ok = cowboy:stop_listener(http).
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue