/// How long before lack of client response causes a timeout
const CLIENT_TIMEOUT: Duration = Duration::from_secs(10);
-pub fn config(cfg: &mut web::ServiceConfig) {
- cfg.service(web::resource("/ws").to(chat_route));
-}
-
/// Entry point for our route
-async fn chat_route(
+pub async fn chat_route(
req: HttpRequest,
stream: web::Payload,
context: web::Data<LemmyContext>,
use lemmy_api_common::{comment::*, community::*, person::*, post::*, site::*, websocket::*};
use lemmy_api_crud::PerformCrud;
use lemmy_utils::rate_limit::RateLimit;
-use lemmy_websocket::LemmyContext;
+use lemmy_websocket::{routes::chat_route, LemmyContext};
use serde::Deserialize;
pub fn config(cfg: &mut web::ServiceConfig, rate_limit: &RateLimit) {
cfg.service(
web::scope("/api/v3")
+ // Websocket
+ .service(web::resource("/ws").to(chat_route))
// Site
.service(
web::scope("/site")
.data(context)
// The routes
.configure(|cfg| api_routes::config(cfg, &rate_limiter))
- .configure(lemmy_websocket::routes::config)
.configure(lemmy_apub::routes::config)
.configure(feeds::config)
.configure(|cfg| images::config(cfg, &rate_limiter))