class Mongrel2::JSONRequest

The Mongrel2 JSON Request class. Instances of this class represent a JSSocket request from a Mongrel2 server.

Attributes

data[R]

The parsed request data

Public Class Methods

new( sender_id, conn_id, path, headers, body, raw=nil ) click to toggle source

Parse the body as JSON.

Calls superclass method Mongrel2::Request::new
# File lib/mongrel2/jsonrequest.rb, line 22
def initialize( sender_id, conn_id, path, headers, body, raw=nil )
        super
        self.log.debug "Parsing JSON request body"
        @data = Yajl.load( body )
        self.log.debug "  body is: %p" % [ @data ]
end

Public Instance Methods

is_disconnect?() click to toggle source

Returns true if the request is a special Mongrel2 'disconnect' notification.

# File lib/mongrel2/jsonrequest.rb, line 40
def is_disconnect?
        return true if self.data['type'] == 'disconnect'
end