Sha256: f2945511d18f29cbf7db54f35f9832ffc2091a5dc3d562f6c6fceb601ebb7d7c

Contents?: true

Size: 660 Bytes

Versions: 8

Compression:

Stored size: 660 Bytes

Contents

module Isomorfeus
  module Transport
    class ServerSocketProcessor
      include Isomorfeus::Transport::ServerProcessor

      def on_message(client, data)
        request_hash = Oj.load(data, mode: :strict)
        result = process_request(client, user(client), request_hash)
        client.write Oj.dump(result, mode: :strict)
      end

      def on_close(client)
        # nothing for now
      end

      def on_open(client)
        # nothing for now
      end

      def on_shutdown(client)
        # nothing for now
      end

      def user(client)
        client.instance_variable_get(:@isomorfeus_user) || Anonymous.new
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
isomorfeus-transport-1.0.0.zeta5 lib/isomorfeus/transport/server_socket_processor.rb
isomorfeus-transport-1.0.0.zeta4 lib/isomorfeus/transport/server_socket_processor.rb
isomorfeus-transport-1.0.0.zeta3 lib/isomorfeus/transport/server_socket_processor.rb
isomorfeus-transport-1.0.0.zeta2 lib/isomorfeus/transport/server_socket_processor.rb
isomorfeus-transport-1.0.0.zeta1 lib/isomorfeus/transport/server_socket_processor.rb
isomorfeus-transport-1.0.0.epsilon4 lib/isomorfeus/transport/server_socket_processor.rb
isomorfeus-transport-1.0.0.epsilon3 lib/isomorfeus/transport/server_socket_processor.rb
isomorfeus-transport-1.0.0.epsilon2 lib/isomorfeus/transport/server_socket_processor.rb