MCPcopy Index your code
hub / github.com/websockets/ws / shouldHandle

Method shouldHandle

lib/websocket-server.js:224–233  ·  view source on GitHub ↗

* See if a given request should be handled by this server instance. * * @param {http.IncomingMessage} req Request object to inspect * @return {Boolean} `true` if the request is valid, else `false` * @public

(req)

Source from the content-addressed store, hash-verified

222 * @public
223 */
224 shouldHandle(req) {
225 if (this.options.path) {
226 const index = req.url.indexOf('?');
227 const pathname = index !== -1 ? req.url.slice(0, index) : req.url;
228
229 if (pathname !== this.options.path) return false;
230 }
231
232 return true;
233 }
234
235 /**
236 * Handle a HTTP Upgrade request.

Callers 2

handleUpgradeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected