implement alternative match-making approach with Lua scripts in Redis

This commit is contained in:
2026-10-25 15:57:24 +03:00
parent 582ecb7c74
commit acdaebd491
19 changed files with 796 additions and 139 deletions
@@ -0,0 +1,4 @@
module ApplicationCable
class Channel < ActionCable::Channel::Base
end
end
@@ -0,0 +1,21 @@
module ApplicationCable
class Connection < ActionCable::Connection::Base
identified_by :current_user
def connect
self.current_user = find_user
reject_unauthorized_connection unless current_user
end
private
def find_user
token = request.params[:token].presence ||
request.headers["Authorization"]&.split(" ")&.last
return unless token
decoded = JwtService.decode(token)
User.find_by(id: decoded[:user_id]) if decoded
end
end
end