Open
Description
What's the best way to protect against someone on the front end simply using while(true){client.emit('i am spammer', true)}
to flood my server with messages?
router := chi.NewRouter()
socketServer := socketio.NewServer(nil)
router.Use(httprate.LimitByIP(1, 5 * time.Second))//This only rate limits incoming client connections, not the client messages.
socketServer.OnConnect("/", func(c socketio.Conn) error {
fmt.Println(c.ID() + ": connected")
c.Join("public_chat")
return nil
})
socketServer.OnEvent("/", "from_client", func(c socketio.Conn, message string) {
fmt.Println(c.ID()+":", message)
})
router.Handle("/", socketServer)
Metadata
Metadata
Assignees
Labels
No labels