Module ringo/jsgi/connector
Low level JSGI adapter implementation.
Functions
- handleRequest(moduleId, functionObj, request)
AsyncResponse (request, timeout, autoflush)
Creates a streaming asynchronous response. The returned response object can be used both synchronously from the current thread or asynchronously from another thread, even after the original thread has finished execution. AsyncResponse objects are threadsafe.
Parameters
Object | request | the JSGI request object |
Number | timeout | the response timeout in milliseconds. Defaults to 30 seconds. |
Boolean | autoflush | whether to flush after each write. |
AsyncResponse.prototype. close ()
Close the response stream, causing all buffered data to be written to the client.
AsyncResponse.prototype. flush ()
Flush the response stream, causing all buffered data to be written to the client.
Returns
this response object for chaining |
AsyncResponse.prototype. start (status, headers)
Set the HTTP status code and headers of the response. This method must only be called once.
Parameters
Number | status | the HTTP status code |
Object | headers | the headers |
Returns
this response object for chaining |
AsyncResponse.prototype. write (data, [encoding])
Write a chunk of data to the response stream.
Parameters
String|Binary | data | a binary or string |
String | [encoding] | the encoding to use |
Returns
this response object for chaining |
handleRequest (moduleId, functionObj, request)
Handle a JSGI request.
Parameters
String | moduleId | the module id. Ignored if functionObj is already a function. |
Function | functionObj | the function, either as function object or function name to be imported from the module moduleId. |
Object | request | the JSGI request object |
Returns
Object | the JSGI response object |