# Client Code

Let’s switch from server to client and subscribe to the chat channel.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Socket.io test</title>
</head>
<body>
    <script src="http://localhost:5000/socket.io/socket.io.js"></script>
    <script>
    const socket = io.connect("http://localhost:5000/", {
        path: "/expressweb-ws",
    });
    socket.to('chat').emit("message", [{ name: "Welcome to my Chat room" }]);
    socket.on("message", (data) => {
        console.log(data);
    });
    </script>
</body>
</html>