listeners.ws.conf.example 2.3 KB

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