Skip to content

Commit

Permalink
feat(rumqttd): enable websocket feature by default (#734)
Browse files Browse the repository at this point in the history
  • Loading branch information
swanandx authored Oct 21, 2023
1 parent 6052d3b commit c6d6d93
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions rumqttd/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
- Log warning if websocket config is getting ignored

### Changed
- Console endpoint /config prints Router Config instead of returning console settings
- v4 config is optional, user can specify v4 and/or v5 config
- websocket feature is enabled by default

### Deprecated
- "websockets" feature is removed in favour of "websocket"

### Removed

Expand Down
3 changes: 1 addition & 2 deletions rumqttd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ axum = "0.6.20"
rand = "0.8.5"

[features]
default = ["use-rustls"]
default = ["use-rustls", "websocket"]
use-rustls = ["dep:tokio-rustls", "dep:rustls-webpki", "dep:rustls-pemfile", "dep:x509-parser"]
use-native-tls = ["dep:tokio-native-tls", "dep:x509-parser"]
websocket = ["dep:async-tungstenite", "dep:tokio-util", "dep:futures-util", "dep:ws_stream_tungstenite"]
websockets = ["websocket"]
validate-tenant-prefix = []
allow-duplicate-clientid = []

Expand Down
7 changes: 6 additions & 1 deletion rumqttd/src/server/broker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use flume::{RecvError, SendError, Sender};
use std::collections::HashMap;
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use std::sync::{Arc, Mutex};
use tracing::{error, field, info, Instrument};
use tracing::{error, field, info, warn, Instrument};

#[cfg(feature = "websocket")]
use async_tungstenite::tokio::accept_hdr_async;
Expand Down Expand Up @@ -230,6 +230,11 @@ impl Broker {
}
}

#[cfg(not(feature = "websocket"))]
if self.config.ws.is_some() {
warn!("websocket feature is disabled, [ws] config will be ignored.");
}

#[cfg(feature = "websocket")]
if let Some(ws_config) = &self.config.ws {
for (_, config) in ws_config.clone() {
Expand Down

0 comments on commit c6d6d93

Please sign in to comment.