ranch.set_transport_options.asciidoc 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. ** `connection_type`
  23. ** `num_conns_sups`
  24. ** `logger`
  25. == Arguments
  26. Ref::
  27. The listener name.
  28. TransOpts::
  29. The new transport options.
  30. == Return value
  31. The atom `ok` is returned on success.
  32. An error tuple is returned on failure, for example if the given
  33. transport options contain invalid values.
  34. == Changelog
  35. * *2.0*: The restriction that the listener must be suspended
  36. has been removed.
  37. * *2.0*: The `TransOpts` argument must no longer contain
  38. Ranch-specific options if given as a list. Use a map.
  39. == Examples
  40. .Set the transport options
  41. [source,erlang]
  42. ----
  43. Ref = example,
  44. ok = ranch:suspend_listener(Ref),
  45. ok = ranch:set_transport_options(Ref, TransOpts),
  46. ok = ranch:resume_listener(Ref).
  47. ----
  48. == See also
  49. link:man:ranch:suspend_listener(3)[ranch:suspend_listener(3)],
  50. link:man:ranch:resume_listener(3)[ranch:resume_listener(3)],
  51. link:man:ranch:get_transport_options(3)[ranch:get_transport_options(3)],
  52. link:man:ranch:set_max_connections(3)[ranch:set_max_connections(3)],
  53. link:man:ranch:set_protocol_options(3)[ranch:set_protocol_options(3)],
  54. link:man:ranch(3)[ranch(3)]