diff --git a/frontend/index.css b/frontend/index.css index 8e400bfc3..79f46c5f4 100644 --- a/frontend/index.css +++ b/frontend/index.css @@ -80,4 +80,17 @@ button { border-radius: 5px; margin-top: 5px; overflow: auto; +} + +/* Close connection button*/ +.close-button { + background-color: #c0392b; /* Red color */ + color: #fff; /* White text color */ + border: none; + padding: 8px 12px; + font-size: 14px; + cursor: pointer; + border-radius: 4px; + float: right; /* Float the button to the right */ + margin: 5px; } \ No newline at end of file diff --git a/frontend/index.html b/frontend/index.html index 2c3ffdaa9..66cb6770e 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -127,8 +127,24 @@ ws.send(webSocketResponseJSON); }; + const closeConnection = () => { + console.log('Closing connection from button'); + if (ws) { + ws.close() + + // Send the response on the WebSocket + let webSocketResponse = { + "Type": "close", + "Value": "" + }; + const webSocketResponseJSON = JSON.stringify(webSocketResponse); + ws.send(webSocketResponseJSON); + } + } + return (
+

WebSocket Console for Port {port}: