* Overrides onRequest. * * @param {EngineRequest} req * @package
(req: EngineRequest)
| 49 | * @package |
| 50 | */ |
| 51 | onRequest(req: EngineRequest) { |
| 52 | const res = req.res; |
| 53 | // remove the reference to the ServerResponse object (as the first request of the session is kept in memory by default) |
| 54 | req.res = null; |
| 55 | |
| 56 | if ("GET" === req.method) { |
| 57 | this.onPollRequest(req, res); |
| 58 | } else if ("POST" === req.method) { |
| 59 | this.onDataRequest(req, res); |
| 60 | } else { |
| 61 | res.writeHead(500); |
| 62 | res.end(); |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * The client sends a request awaiting for us to send data. |
no test coverage detected