Switch default transport to WebSocket
- Dockerfile builds with --features websocket and sets VITE_TRANSPORT=websocket - Server default feature changed from socketio to websocket - Binary canvas transfer (1MB) instead of Socket.IO JSON (~3-4MB per connection) - Significantly reduces memory pressure under concurrent connections
This commit is contained in:
@@ -3,6 +3,7 @@ WORKDIR /app/painter-js
|
||||
COPY painter-js/package.json painter-js/bun.lock ./
|
||||
RUN bun install --frozen-lockfile
|
||||
COPY painter-js/ .
|
||||
ENV VITE_TRANSPORT=websocket
|
||||
RUN bun run build
|
||||
|
||||
FROM rust:1-alpine AS builder
|
||||
@@ -13,10 +14,11 @@ COPY Cargo.toml Cargo.lock ./
|
||||
COPY crates/ ./crates/
|
||||
|
||||
RUN mkdir -p painter-js/dist && echo '<html></html>' > painter-js/dist/index.html
|
||||
RUN cargo build --release --bin server 2>&1 || true
|
||||
RUN cargo build --release --bin server --no-default-features --features websocket 2>&1 || true
|
||||
|
||||
COPY --from=frontend /app/painter-js/dist ./painter-js/dist
|
||||
RUN touch crates/adapters/http-axum/src/routes.rs && cargo build --release --bin server
|
||||
RUN touch crates/adapters/http-axum/src/routes.rs && \
|
||||
cargo build --release --bin server --no-default-features --features websocket
|
||||
|
||||
FROM scratch
|
||||
COPY --from=builder /app/target/release/server /painter
|
||||
|
||||
@@ -4,7 +4,7 @@ version.workspace = true
|
||||
edition.workspace = true
|
||||
|
||||
[features]
|
||||
default = ["socketio"]
|
||||
default = ["websocket"]
|
||||
socketio = ["dep:socketio", "dep:socketioxide"]
|
||||
websocket = ["dep:websocket"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user