Skip to content

Commit

Permalink
Add wsecho
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmue committed May 23, 2022
1 parent dbe25ec commit c80a540
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
15 changes: 15 additions & 0 deletions wsecho/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM golang:1.18-bullseye

WORKDIR /opt
COPY wsecho.patch .

RUN apt-get update && apt-get install -y patch && \
git clone https://github.com/gorilla/websocket.git -b v1.5.0 && \
patch -n websocket/examples/chat/client.go < wsecho.patch && \
cd websocket && \
go install -v ./examples/chat

FROM debian:bullseye

COPY --from=0 /go/bin/chat /usr/local/bin/wsecho
CMD ["/usr/local/bin/wsecho"]
5 changes: 5 additions & 0 deletions wsecho/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# wsecho

This Dockerfile builds a slightly patched version of the [Gorilla "chat" example](https://github.com/gorilla/websocket/tree/78cf1bc733a927f673fd1988a25256b425552a8a/examples/chat).
The patch removes the message size limit as many messages contain the whole shared state.
That should be okay if access to the server is restricted.
2 changes: 2 additions & 0 deletions wsecho/wsecho.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
61d60
< c.conn.SetReadLimit(maxMessageSize)

0 comments on commit c80a540

Please sign in to comment.