listeners.ws.conf.example 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. ## for to disable this
  13. enable = true
  14. ## Port or Address to listen on
  15. bind = "0.0.0.0:8083" # or just a port number, e.g. 8083
  16. ## WebSocket's MQTT protocol path
  17. ## Type: String
  18. ## For Example:
  19. ## with the default value, the address of EMQX Broker's WebSocket is: ws://8083/mqtt
  20. mqtt_path = "/mqtt"
  21. ## Whether a WebSocket message is allowed to contain multiple MQTT packets
  22. ## Type: single | multiple
  23. mqtt_piggyback = multiple
  24. ## If true, compress WebSocket messages using zlib
  25. compress = false
  26. ## Close transport-layer connections from the clients that have not sent MQTT CONNECT message within this interval
  27. idle_timeout = 7200s
  28. ## The maximum length of a single MQTT packet
  29. ## Type: infinity | Integer
  30. max_frame_size = infinity
  31. ## If true, the server will return an error when the client does not carry the Sec-WebSocket-Protocol field
  32. fail_if_no_subprotocol = true
  33. ## Comma-separated list of supported subprotocols
  34. ## Type: Comma Separated List
  35. supported_subprotocols = "mqtt, mqtt-v3, mqtt-v3.1.1, mqtt-v5"
  36. ## If true, origin HTTP header will be validated against the list of allowed origins configured in check_origins parameter
  37. check_origin_enable = false
  38. ## If false and check_origin_enable is true, the server will reject requests that don't have origin HTTP header
  39. allow_origin_absence = true
  40. ## List of allowed origins
  41. ## Type: Comma Separated List
  42. check_origins = "http://localhost:18083, http://127.0.0.1:18083"
  43. ## HTTP header used to pass information about the client IP address
  44. proxy_address_header = "x-forwarded-for"
  45. ## The maximum length of a single MQTT packet
  46. proxy_port_header = "x-forwarded-port"
  47. }