overwolf.web.webserver API
web.webserver
is an instance an Overwolf webserver. These can be created using the overwolf.web.createServer()
method.
The OW webserver is CORS enabled and sends the Access-Control-Allow-Origin headers to clients.
Cross-Origin Resource Sharing (CORS) is a mechanism that uses additional HTTP headers to tell browsers to give a web application running at one origin, access to selected resources from a different origin. The CORS mechanism supports secure cross-origin requests and data transfers between browsers and servers.
It's useful for case when you need to pass some data (ex: authentication token) from your website to Overwolf app.
Methods Reference
Events Reference
Types Reference
listen(callback)
Version added: 0.93
Listens for requests on the given port.
If the port is already in use, or this instance is already listening, an error will be returned.
Parameter | Type | Description |
---|---|---|
callback | (Result) => void | A callback function which will be called with the status of the request |
Callback argument: Success
A callback function which will be called with the status of the request
{
"status": "success",
"url": "http://localhost:7707/"
}
close()
Version added: 0.93
Closes the web server. It can be re-opened again.
onRequest
Version added: 0.93
Fired when the web server receives an incoming request, with the following structure: RequestEvent Object.
RequestEvent Object
Version added: 0.93
Container for the Requestevent object.
Parameter | Type | Description |
---|---|---|
url | string | |
content | string | |
contentType | string |