Skip to content

Commit

Permalink
Merge pull request #13 from drifting-in-space/paulgb/switch-to-axum
Browse files Browse the repository at this point in the history
Switch server implementation to Axum (WIP)
  • Loading branch information
paulgb authored Apr 19, 2024
2 parents 70a6e40 + 5264ff0 commit d6e47c0
Show file tree
Hide file tree
Showing 21 changed files with 540 additions and 1,200 deletions.
820 changes: 301 additions & 519 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"

exclude = [
"examples",
Expand Down
Binary file added examples/echo-server/dist/server.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion stateroom-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ clap = { version = "4.1.6", features = ["derive"] }
fs_extra = "1.2.0"
serde = { version = "1.0.127", features = ["derive"] }
stateroom = { path="../stateroom", version="0.2.8" }
stateroom-server = { path="../stateroom-server", version="0.2.8", features=["serve-static"] }
stateroom-server = { path="../stateroom-server", version="0.3.0" }
stateroom-stdio = { path="../stateroom-stdio", version="0.2.8" }
stateroom-wasm-host = { path="../stateroom-wasm-host", version="0.2.8" }
toml = "0.8.12"
Expand Down
4 changes: 2 additions & 2 deletions stateroom-cli/src/cli_opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub enum SubCommand {
Build,
Dev {
#[clap(default_value = "8080")]
port: u32,
port: u16,
},
}

Expand All @@ -34,7 +34,7 @@ pub struct ServeCommand {

/// The port to serve on.
#[clap(short, long, default_value = "8080")]
pub port: u32,
pub port: u16,

/// The time interval (in seconds) between WebSocket heartbeat pings.
#[clap(short = 'i', long, default_value = "30")]
Expand Down
2 changes: 1 addition & 1 deletion stateroom-cli/src/commands/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::build_util::{do_build, locate_config};
use stateroom_server::Server;
use stateroom_wasm_host::WasmHostFactory;

pub fn dev(port: u32) -> anyhow::Result<()> {
pub fn dev(port: u16) -> anyhow::Result<()> {
let config = locate_config()?; // TODO: default to a configuration if file not found.

let build_result = do_build(&config)?;
Expand Down
3 changes: 1 addition & 2 deletions stateroom-cli/src/commands/serve.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use std::{ffi::OsStr, path::Path, time::Duration};

use crate::cli_opts::ServeCommand;
use stateroom_server::Server;
use stateroom_stdio::StdioProcessServiceFactory;
use stateroom_wasm_host::WasmHostFactory;
use std::{ffi::OsStr, path::Path, time::Duration};

pub fn serve(serve_opts: ServeCommand) -> anyhow::Result<()> {
let ServeCommand {
Expand Down
21 changes: 7 additions & 14 deletions stateroom-server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
[package]
name = "stateroom-server"
version = "0.2.9"
edition = "2018"
version = "0.3.0"
edition = "2021"
readme = "README.md"
repository = "https://github.com/drifting-in-space/stateroom"
license = "MIT OR Apache-2.0"
keywords = ["websocket"]
description = "Actix server actor implementation of Stateroom services"

[features]
default = []
serve-static = ["actix-files"]
description = "Server for Stateroom services over WebSockets"

[dependencies]
actix = "0.13.0"
actix-files = { version = "0.6.0", optional=true }
actix-web = "4.0.1"
actix-web-actors = "4.1.0"
axum = { version = "0.7.5", features = ["ws"] }
dashmap = "5.5.3"
futures-util = "0.3.30"
stateroom = {path="../stateroom", version="0.2.8"}
serde = { version = "1.0.126", features = ["derive"] }
serde_json = "1.0.68"
tracing = "0.1.28"
tokio = { version = "1.37.0", features = ["rt-multi-thread"] }
9 changes: 0 additions & 9 deletions stateroom-server/README.md

This file was deleted.

93 changes: 0 additions & 93 deletions stateroom-server/src/client_socket_connection.rs

This file was deleted.

8 changes: 0 additions & 8 deletions stateroom-server/src/connection_info.rs

This file was deleted.

Loading

0 comments on commit d6e47c0

Please sign in to comment.