An application for Go knowledge assessment.
This is a web application that utilises websockets. A client connects on localhost:8080
and has three options: a) open
a websocket connection that reads values from a counter b) close
the websocket and c) reset the counter to zero. The counter is feeded from a random string generator. On WS session termination, statistics for terminated session are printed.
The application is compiled by running make
in the root folder and the final binaries are found in the bin/
folder.
The application has some problems described below that need to be addressed plus some new features that need implementation.
The server prints statistics for each WS sessioned closed but it seems to only count one message while there are more send to each WS session, e.g.
2024/03/29 18:28:38 stats.go:11: session a938e316-8536-46e6-8633-bd309fbcf579 has received 1 messages
A more then normal memory usage is observed after many WS sessions which needs investigation.
A cross-site request forgery is reported by a security audit which needs fixing.
Modify the random string generator to generate only hex values and verify its accuracy and resource usage by creating a test and a benchmark run.
Extent the API to return the Hex value in WS connection. I.e. a browser that open a connection to localhost:8080
should see the HEX values.
Create a command line client as a separate application that opens a requested number of sessions simultaneously.
This should be a separate executable generated with the make
command in the bin/
folder that will accept an argument with the number of parallel connections that will open on the server. The server part must be modified in a way to support multiple parallel connections and should still print valid statistics for each connection.