Sha256: 0c4429ef295613362e49821999b2f8c92ac8e7fba9e721dd8ab6cea961aae332

Contents?: true

Size: 700 Bytes

Versions: 51

Compression:

Stored size: 700 Bytes

Contents

require 'rubypitaya/core/nats_connector'

module RubyPitaya

  class Postman

    MESSAGE_ROUTE_BIND_SESSION = 'sys.bindsession'

    def initialize(nats_connector)
      @nats_connector = nats_connector
    end

    def bind_session(session)
      route = MESSAGE_ROUTE_BIND_SESSION

      nats_session = NatsSession.new(
        id: session.id,
        uid: session.uid,
        data: session.data.to_json,
      )

      payload = NatsSession.encode(nats_session)

      response = @nats_connector.push_to_frontend(session, route, payload)

      response
    end

    def push_to_user(uid, message_route, payload)
      @nats_connector.push_to_user(uid, message_route, payload)
    end
  end
end

Version data entries

51 entries across 47 versions & 1 rubygems

Version Path
rubypitaya-3.19.3 ./lib/rubypitaya/core/postman.rb
rubypitaya-3.19.2 ./lib/rubypitaya/core/postman.rb
rubypitaya-3.19.1 ./lib/rubypitaya/core/postman.rb
rubypitaya-3.19.0 ./lib/rubypitaya/core/postman.rb
rubypitaya-3.18.0 ./lib/rubypitaya/core/postman.rb
rubypitaya-3.17.2 ./lib/rubypitaya/core/postman.rb
rubypitaya-3.17.1 ./lib/rubypitaya/core/postman.rb
rubypitaya-3.17.0 ./lib/rubypitaya/core/postman.rb
rubypitaya-3.16.0 ./lib/rubypitaya/core/postman.rb
rubypitaya-3.15.3 ./lib/rubypitaya/core/postman.rb
rubypitaya-3.15.2 ./lib/rubypitaya/core/postman.rb
rubypitaya-3.15.1 ./lib/rubypitaya/core/postman.rb
rubypitaya-3.15.0 ./lib/rubypitaya/core/postman.rb
rubypitaya-3.14.0 ./lib/rubypitaya/core/postman.rb
rubypitaya-3.13.1 ./lib/rubypitaya/core/postman.rb
rubypitaya-3.13.0 ./lib/rubypitaya/core/postman.rb
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rubypitaya-3.12.1/lib/rubypitaya/core/postman.rb
rubypitaya-3.12.5 ./lib/rubypitaya/core/postman.rb
rubypitaya-3.12.4 ./lib/rubypitaya/core/postman.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rubypitaya-3.12.1/lib/rubypitaya/core/postman.rb