Skip to content

Latest commit

 

History

History
35 lines (24 loc) · 1.08 KB

README.md

File metadata and controls

35 lines (24 loc) · 1.08 KB

Twitch

Mock Twitch chat socket server


Project Inspiration

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.

Example Client Connection

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()
  }
}, [])