Now you can rate limit websocket clients with a token based system to pump the brakes on clients that are asking too much of your relay
Enhancements
- Add token based websocket rate limiter to websocket handler
- Closes websocket connection and sends client
"OK"rate limit message- Limits by client IP address
- Sends
gaugemetric withclienttag to StatsD server to keep track of rate limited clients
- After some time passes, token bucket is refilled and client can make requests again provided they stay under their rate limit
- Closes websocket connection and sends client
- Reply to client with
"NOTICE"message when subscription closes- Also sends
"OK"truemessage to client when event successfully added
- Also sends
- Many organizational improvements in websocket handler
- New
ExtractedResponseandWebsocketMessageshelp organize and make for more readable code- Parse and format messages outside of the handler functions
- New
Bug Fixes
- Fixed duplicate
EOSEmessage returned to client from websocket subscription handler - Fixed
rediscached result parsing bug that was returning a single]as content for aREQmessage whenrediscache returnedb"[]"- Try/except block for parsing, does not send
redisresults less than 2 charecters back to websocket handler, instead sendsEOSE
- Try/except block for parsing, does not send