Mock Twitch chat socket server
This project was inspired after watching a React mock interview by Theo with Dan Abramov. In this mock interview, Theo has created a socket server that replicates Twitch chat messages and challenges Dan to build the frontend in React to handle incoming messages in a chat-like interface. This sparked my interested in socket.io, so I decided to replicate the server.
Connects to chat server using socket running on port 4000.
const connectTwitchChat = () => {
const socket = io('http://localhost:4000')
socket.onAny((type, message) => console.log(type, message))
return socket
}
useEffect(() => {
const socket = connectTwitchChat()
return () => {
socket.disconnect()
}
}, [])