Sha256: dcaa41f3b2acf2299d100248cab874a49e6895051f871b368f0d33e3b469e886
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
Contents
# frozen_string_literal: true require "fileutils" require "pakyow/support/extension" require "pakyow/support/serializer" module Pakyow module Realtime module Behavior # Persists the in-memory realtime server across restarts. # module Serialization extend Support::Extension apply_extension do on "shutdown", priority: :high do if Pakyow.config.realtime.adapter == :memory && instance_variable_defined?(:@websocket_server) realtime_server_serializer.serialize end end after "boot" do if Pakyow.config.realtime.adapter == :memory realtime_server_serializer.deserialize end end end private def realtime_server_serializer Support::Serializer.new( @websocket_server.adapter, name: "#{config.name}-realtime", path: File.join( Pakyow.config.root, "tmp", "state" ) ) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pakyow-realtime-1.0.0.rc2 | lib/pakyow/realtime/behavior/serialization.rb |
pakyow-realtime-1.0.0.rc1 | lib/pakyow/realtime/behavior/serialization.rb |