listeners.ws.conf.example 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. ##--------------------------------------------------------------------
  2. ## WebSocket Listener
  3. ##
  4. ## Add a WebSocket Listener
  5. ##--------------------------------------------------------------------
  6. ## Note: This is an example of how to configure this feature
  7. ## you should copy and paste the below data into the emqx.conf for working
  8. ## The WebSocket listener supports all the fields listed in listeners.tcp.conf.example
  9. ## only the WebSocket-specific fields are shown here
  10. ## Note: Modifying the 'wsname' to what you need
  11. listeners.ws.wsname {
  12. ## Port or Address to listen on, 0 means disable
  13. bind = "0.0.0.0:8083" # or just a port number, e.g. 8083
  14. enabled = true
  15. enable_authn = true
  16. max_connections = infinity
  17. proxy_protocol = false
  18. proxy_protocol_timeout = 3s
  19. mountpoint = ""
  20. tcp_options {
  21. active_n = 100
  22. backlog = 1024
  23. buffer = 4KB
  24. high_watermark = 1MB
  25. keepalive = none
  26. nodelay = true
  27. reuseaddr = true
  28. send_timeout = 15s
  29. send_timeout_close = true
  30. }
  31. websocket {
  32. ## WebSocket's MQTT protocol path
  33. ## Type: String
  34. ## For Example:
  35. ## with the default value, the address of EMQX Broker's WebSocket is: ws://8083/mqtt
  36. mqtt_path = "/mqtt"
  37. ## Whether a WebSocket message is allowed to contain multiple MQTT packets
  38. ## Type: single | multiple
  39. mqtt_piggyback = multiple
  40. ## If true, compress WebSocket messages using zlib
  41. compress = false
  42. ## Close transport-layer connections from the clients that have not sent MQTT CONNECT message within this interval
  43. idle_timeout = 7200s
  44. ## The maximum length of a single MQTT packet
  45. ## Type: infinity | Integer
  46. max_frame_size = infinity
  47. ## If true, the server will return an error when the client does not carry the Sec-WebSocket-Protocol field
  48. fail_if_no_subprotocol = true
  49. ## Comma-separated list of supported subprotocols
  50. supported_subprotocols = "mqtt, mqtt-v3, mqtt-v3.1.1, mqtt-v5"
  51. ## If true, origin HTTP header will be validated against the list of allowed origins configured in check_origins parameter
  52. check_origin_enable = false
  53. ## If false and check_origin_enable is true, the server will reject requests that don't have origin HTTP header
  54. allow_origin_absence = true
  55. ## List of allowed origins
  56. check_origins = "http://localhost:18083, http://127.0.0.1:18083"
  57. ## HTTP header used to pass information about the client IP address
  58. proxy_address_header = "x-forwarded-for"
  59. ## The maximum length of a single MQTT packet
  60. proxy_port_header = "x-forwarded-port"
  61. }
  62. }