enable websocket listener
Closed this issue · 3 comments
acelabs88 commented
How can I enable websocket listener?
angeloskaltsikis commented
Hey @acelabs88 ,
For what do you want that?
acelabs88 commented
@angeloskaltsikis I would like to enable websocket for hivemq, so that the browser can directly pub/sub messages.
fraschbi commented
Hi @acelabs88,
You can configure Websockets in the listener configuration of HiveMQ.
Once you opened a port for websockets you need to then also make sure that you create a service that exposes this port.
Example values.yaml
hivemq:
listenerConfiguration: |
<tcp-listener>
<port>${HIVEMQ_MQTT_PORT}</port>
<bind-address>0.0.0.0</bind-address>
</tcp-listener>
<websocket-listener>
<port>8000</port>
<bind-address>0.0.0.0</bind-address>
<path>/mqtt</path>
<name>my-websocket-listener</name>
<subprotocols>
<subprotocol>mqttv3.1</subprotocol>
<subprotocol>mqtt</subprotocol>
</subprotocols>
<allow-extensions>true</allow-extensions>
</websocket-listener>
ports:
- name: "mqtt"
port: 1883
expose: true
patch:
- '[{"op":"add","path":"/spec/selector/hivemq.com~1node-offline","value":"false"},{"op":"add","path":"/metadata/annotations","value":{"service.spec.externalTrafficPolicy":"Local"}}]'
# If you want Kubernetes to expose the MQTT port to external traffic
# - '[{"op":"add","path":"/spec/type","value":"LoadBalancer"}]'
- name: "cc"
port: 8080
expose: true
patch:
- '[{"op":"add","path":"/spec/sessionAffinity","value":"ClientIP"}]'
# If you want Kubernetes to expose the HiveMQ control center via load balancer.
# Warning: You should consider configuring proper security and TLS beforehand. Ingress may be a better option here.
# - '[{"op":"add","path":"/spec/type","value":"LoadBalancer"}]'
- name: "mqtt-ws"
port: 8000
expose: true
patch:
- '[{"op":"add","path":"/spec/selector/hivemq.com~1node-offline","value":"false"},{"op":"add","path":"/metadata/annotations","value":{"service.spec.externalTrafficPolicy":"Local"}}]'
Cheers,
Florian