ranch.set_transport_options.asciidoc 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. = ranch:set_transport_options(3)
  2. == Name
  3. ranch:set_transport_options - Set the transport options
  4. == Description
  5. [source,erlang]
  6. ----
  7. set_transport_options(Ref :: ranch:ref(),
  8. TransOpts :: ranch:opts())
  9. -> ok | {error, Reason :: term()}
  10. ----
  11. Set the transport options.
  12. Changes to the following options will take effect...
  13. * immediately:
  14. ** `max_connections`
  15. ** `handshake_timeout`
  16. ** `shutdown`
  17. * only after the listener has been suspended and resumed:
  18. ** `num_acceptors`
  19. ** `num_listen_sockets`
  20. ** `socket_opts`
  21. * only when the entire listener is restarted:
  22. ** `num_conns_sups`
  23. ** `logger`
  24. == Arguments
  25. Ref::
  26. The listener name.
  27. TransOpts::
  28. The new transport options.
  29. == Return value
  30. The atom `ok` is returned on success.
  31. An error tuple is returned on failure, for example if the given
  32. transport options contain invalid values.
  33. == Changelog
  34. * *2.0*: The restriction that the listener must be suspended
  35. has been removed.
  36. * *2.0*: The `TransOpts` argument must no longer contain
  37. Ranch-specific options if given as a list. Use a map.
  38. == Examples
  39. .Set the transport options
  40. [source,erlang]
  41. ----
  42. Ref = example,
  43. ok = ranch:suspend_listener(Ref),
  44. ok = ranch:set_transport_options(Ref, TransOpts),
  45. ok = ranch:resume_listener(Ref).
  46. ----
  47. == See also
  48. link:man:ranch:suspend_listener(3)[ranch:suspend_listener(3)],
  49. link:man:ranch:resume_listener(3)[ranch:resume_listener(3)],
  50. link:man:ranch:get_transport_options(3)[ranch:get_transport_options(3)],
  51. link:man:ranch:set_max_connections(3)[ranch:set_max_connections(3)],
  52. link:man:ranch:set_protocol_options(3)[ranch:set_protocol_options(3)],
  53. link:man:ranch(3)[ranch(3)]