Get started with Unreal Web Server

Enable plugin

To get started, first ensure that the plugin is installed, by visiting the Plugin Window. Then, enable the plugin if it’s not already done.

All blueprints nodes explained in the following manual can be found in UnrealWebServer category.

Get, Start, Stop server

Unreal Web Server’s main class is a Singleton (that restricts the instantiation of the UWS class to one object). You can GET this class anywhere in your blueprints using the function GetOrCreateWebServerInstance. As it name means, this function will get the UWS instance if it exists. Otherwise, this function will create it. In each case, a UWS instance is returned.

Once you have this instance, you can start it using the StartServer function. This function needs :

We strongly recommend starting the server in the level blueprint, in the BeginPlay event.

The server needs to be properly stopped. You must use the StopServer function (in the EndPlay event for instance) to do this job and avoid further issues.

At this step, you should be able to access to your UWS by navigating at (assuming 8080 is the server port) in a web browser. Because you don’t have set any web file or URI handler, the response will be “404 Not found”.

Register URI handlers

Once the UWS is properly running, you can add URI Handlers. A URI Handler is needed to map a specific URL to a specific Unreal behavior (blueprint event).

A URI handler is registered by using the AddURIHandler function. This function needs :

Of course, you can either create a custom event or map a function to the callback, such as on the picture.

Asterisk in URI Handler’s Path

With the upgrade UWS 1.5, you can use the asterisk in the URI Handler’s path. It allows you to match any symbol or group of symbols in the URI.

For instance if you want to match every possible URL, just use “*”. If you want to match any URL under the /Group1 path, use “/Group1/*”.

To get the uri path called by the user, you can use the function Connection::GetUriPath.