Create a Node server/client app that communicates via socket.io
.
Connection
The server should listen for socket.io
connections and let any clients
know, on connection, that they've successfully connected. The server should
emit a success message to the client through the socket.io
channel.
The client, once connected to the server's socket.io
channel, should receive
that message and output it within the HTML body.
Data Transfer
The server should also accept requests (through the socket.io
channel) to
emit its environment variables (process.env
) to the client.
On the client, a user should be able to click a form button that sends the request to the server for its environment variables, and the server should respond as such.
Since we are communicating over an insecure connection, the process.env
should
be stringified and encrypted with a strong cipher and passphrase. You should use
Node's built in crypto
module.
- The exercise must be completed within an hour. You may use the web as a resource.
- You may only use one dependency:
socket.io
.- You will only need two methods:
socket.on
andsocket.emit
.
- You will only need two methods:
- Your server must serve the client page on port
9999
. - Your server must listen for
socket.io
connections on9998
. - The server should alert the client of a successful connection.
- The server should respond to the client's request for its
process.env
object. - The server should encrypt
process.env
before sending it to the client.- Use an 'AES-128' encryption algorithm or higher.
- You do not need to use/sign an encryption key, a simple passphrase is sufficient.
- The client page should follow valid HTML and Javascript syntax.
- The client page should not include any external libraries other than
socket.io
.
Your code will be evaluated on cleanliness and functionality. If you have not
used socket.io
before, you may take a few minutes to view their "Get Started"
page: https://socket.io/get-started/chat/