Skip to content
Snippets Groups Projects
Commit c29113f8 authored by Falk Rehse's avatar Falk Rehse
Browse files

Rename to websockets

parent fc187764
No related branches found
No related tags found
No related merge requests found
Pipeline #118736 failed
...@@ -19,11 +19,11 @@ RUN yarn build ...@@ -19,11 +19,11 @@ RUN yarn build
FROM docker.io/library/alpine:latest FROM docker.io/library/alpine:latest
ARG SPOCCIFY_HTTP_BIND_HOST 0.0.0.0 ENV SPOCCIFY_HTTP_BIND_HOST 0.0.0.0
ARG SPOCCIFY_HTTP_BIND_PORT 9000 ENV SPOCCIFY_HTTP_BIND_PORT 9000
ARG SPOCCIFY_WEBSOCKET_BIND_HOST 0.0.0.0 ENV SPOCCIFY_WEBSOCKETS_BIND_HOST 0.0.0.0
ARG SPOCCIFY_WEBSOCKET_BIND_PORT 9001 ENV SPOCCIFY_WEBSOCKETS_BIND_PORT 9001
RUN apk add ffmpeg yt-dlp RUN apk add ffmpeg yt-dlp
COPY --from=builder-backend /usr/src/spoccify/target/release/spoccify /spoccify/spoccify COPY --from=builder-backend /usr/src/spoccify/target/release/spoccify /spoccify/spoccify
......
...@@ -10,7 +10,7 @@ use tower_http::services::ServeDir; ...@@ -10,7 +10,7 @@ use tower_http::services::ServeDir;
// use crate::song::Song; // use crate::song::Song;
pub async fn handle_http(http_bind_address: &str, /* playlist_websocket: &Mutable<Vec<Song>> */) { pub async fn handle_http(http_bind_address: &str, /* playlist: &Mutable<Vec<Song>> */) {
println!("Listening for http connections on {}!", http_bind_address); println!("Listening for http connections on {}!", http_bind_address);
async fn handle_404() -> (StatusCode, &'static str) { async fn handle_404() -> (StatusCode, &'static str) {
......
...@@ -4,7 +4,7 @@ mod http; ...@@ -4,7 +4,7 @@ mod http;
mod player; mod player;
mod song; mod song;
mod util; mod util;
mod websocket; mod websockets;
mod websocket_command; mod websocket_command;
use futures_signals::signal::Mutable; use futures_signals::signal::Mutable;
...@@ -34,17 +34,17 @@ async fn main() { ...@@ -34,17 +34,17 @@ async fn main() {
let client_token = let client_token =
Arc::new(env::var("SPOCCIFY_CLIENT_TOKEN").expect("No client token provided!")); Arc::new(env::var("SPOCCIFY_CLIENT_TOKEN").expect("No client token provided!"));
let websocket_bind_host = let websockets_bind_host =
env::var("SPOCCIFY_WEBSOCKET_BIND_HOST").unwrap_or("127.0.0.1".to_owned()); env::var("SPOCCIFY_WEBSOCKETS_BIND_HOST").unwrap_or("127.0.0.1".to_owned());
let websocket_bind_port = env::var("SPOCCIFY_WEBSOCKET_BIND_PORT").unwrap_or("9001".to_owned()); let websockets_bind_port = env::var("SPOCCIFY_WEBSOCKETS_BIND_PORT").unwrap_or("9001".to_owned());
let websocket_bind_address = format!("{}:{}", websocket_bind_host, websocket_bind_port); let websockets_bind_address = format!("{}:{}", websockets_bind_host, websockets_bind_port);
let _websockets_task = tokio::task::spawn(async move { let _websockets_task = tokio::task::spawn(async move {
websocket::handle_websockets( websockets::handle_websockets(
&player_token, &player_token,
&client_token, &client_token,
&websocket_bind_address, &websockets_bind_address,
&playlist_websockets, &playlist_websockets,
) )
.await; .await;
......
...@@ -13,14 +13,14 @@ use crate::song::Song; ...@@ -13,14 +13,14 @@ use crate::song::Song;
pub async fn handle_websockets( pub async fn handle_websockets(
player_token: &Arc<String>, player_token: &Arc<String>,
client_token: &Arc<String>, client_token: &Arc<String>,
websocket_bind_address: &str, websockets_bind_address: &str,
playlist_websocket: &Mutable<Vec<Song>>, playlist_websocket: &Mutable<Vec<Song>>,
) { ) {
let server = TcpListener::bind(websocket_bind_address).expect("Failed to bind websocket port!"); let server = TcpListener::bind(websockets_bind_address).expect("Failed to bind websocket port!");
println!( println!(
"Listening for websocket connections on {}!", "Listening for websocket connections on {}!",
websocket_bind_address websockets_bind_address
); );
for stream in server.incoming() { for stream in server.incoming() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment