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
gauge
metric withclient
tag 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"
true
message to client when event successfully added
- Also sends
- Many organizational improvements in websocket handler
- New
ExtractedResponse
andWebsocketMessages
help organize and make for more readable code- Parse and format messages outside of the handler functions
- New
Bug Fixes
- Fixed duplicate
EOSE
message returned to client from websocket subscription handler - Fixed
redis
cached result parsing bug that was returning a single]
as content for aREQ
message whenredis
cache returnedb"[]"
- Try/except block for parsing, does not send
redis
results less than 2 charecters back to websocket handler, instead sendsEOSE
- Try/except block for parsing, does not send