mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-14 00:14:03 +00:00
Fix websocket location to /api/vX
This commit is contained in:
parent
4c8f2e976e
commit
4da6e42fc1
3 changed files with 4 additions and 7 deletions
|
@ -15,12 +15,8 @@ const HEARTBEAT_INTERVAL: Duration = Duration::from_secs(5);
|
||||||
/// How long before lack of client response causes a timeout
|
/// How long before lack of client response causes a timeout
|
||||||
const CLIENT_TIMEOUT: Duration = Duration::from_secs(10);
|
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
|
/// Entry point for our route
|
||||||
async fn chat_route(
|
pub async fn chat_route(
|
||||||
req: HttpRequest,
|
req: HttpRequest,
|
||||||
stream: web::Payload,
|
stream: web::Payload,
|
||||||
context: web::Data<LemmyContext>,
|
context: web::Data<LemmyContext>,
|
||||||
|
|
|
@ -3,12 +3,14 @@ use lemmy_api::Perform;
|
||||||
use lemmy_api_common::{comment::*, community::*, person::*, post::*, site::*, websocket::*};
|
use lemmy_api_common::{comment::*, community::*, person::*, post::*, site::*, websocket::*};
|
||||||
use lemmy_api_crud::PerformCrud;
|
use lemmy_api_crud::PerformCrud;
|
||||||
use lemmy_utils::rate_limit::RateLimit;
|
use lemmy_utils::rate_limit::RateLimit;
|
||||||
use lemmy_websocket::LemmyContext;
|
use lemmy_websocket::{routes::chat_route, LemmyContext};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
pub fn config(cfg: &mut web::ServiceConfig, rate_limit: &RateLimit) {
|
pub fn config(cfg: &mut web::ServiceConfig, rate_limit: &RateLimit) {
|
||||||
cfg.service(
|
cfg.service(
|
||||||
web::scope("/api/v3")
|
web::scope("/api/v3")
|
||||||
|
// Websocket
|
||||||
|
.service(web::resource("/ws").to(chat_route))
|
||||||
// Site
|
// Site
|
||||||
.service(
|
.service(
|
||||||
web::scope("/site")
|
web::scope("/site")
|
||||||
|
|
|
@ -91,7 +91,6 @@ async fn main() -> Result<(), LemmyError> {
|
||||||
.data(context)
|
.data(context)
|
||||||
// The routes
|
// The routes
|
||||||
.configure(|cfg| api_routes::config(cfg, &rate_limiter))
|
.configure(|cfg| api_routes::config(cfg, &rate_limiter))
|
||||||
.configure(lemmy_websocket::routes::config)
|
|
||||||
.configure(lemmy_apub::routes::config)
|
.configure(lemmy_apub::routes::config)
|
||||||
.configure(feeds::config)
|
.configure(feeds::config)
|
||||||
.configure(|cfg| images::config(cfg, &rate_limiter))
|
.configure(|cfg| images::config(cfg, &rate_limiter))
|
||||||
|
|
Loading…
Reference in a new issue