Working on major restructuring

This commit is contained in:
2025-12-20 15:30:24 -07:00
parent f4c5ba1f14
commit 645a47b98a
53 changed files with 226 additions and 1407 deletions
+27
View File
@@ -0,0 +1,27 @@
require "json"
module GameServer
module Server
class Connection
def initialize(ws, world)
@ws = ws
@world = world
@router = MessageRouter.new(world)
end
def run
Logging.logger.info "connection opened"
while msg = @ws.read
data = JSON.parse(msg)
response = @router.handle(data)
@ws.write(JSON.dump(response)) if response
end
rescue => e
Logging.logger.error e.message
ensure
Logging.logger.info "connection closed"
end
end
end
end