Connect an unmanaged service

In an unmanaged service, the service is started outside of PureWeb by an independent entity, such as the end user or another application; the service must be running in order for the PureWeb server to establish a session. This approach makes it possible for the service and the server to reside on different nodes. See Connection workflow.

This section describes how to set up the connection between an unmanaged service and the PureWeb server.

Unmanaged services are not currently supported in Java.


Set up the connection

APIs:

StateManagerServer.start() | C++ | .Net

Because an unmanaged service can reside on a different node than the PureWeb server, you must provide the server's IP address and port number as parameters to the start method. This enables the service to locate the server.

In the snippets below, this information is hard-coded directly in the method call, but you can also use environment variables as explained a little further down.

C++

Server->Start(StateManager, 127.0.0.1, 8082);

.Net

server.Start(StateManager, 127.0.0.1, 8082);	

Once the service is connected to the PureWeb server, remote clients will be able to connect to the established service session.

You can also configure rules for service-server interactions (such as timeout values) in the PureWeb server configuration files. For more information, see Service-server interaction properties.

About the environment variables

The PureWeb server's IP address and port number can be managed through environment variables. The variables below are set automatically by PureWeb, and you only need to worry about them if you want to override the defaults.

  • PUREWEB_PORT: The port that the service application uses when it establishes the socket connection to the PureWeb server. Defaults to port 8082. See also Configuring the ports.
  • PUREWEB_APPSERVER: The IP address of the PureWeb server. Services use the value of this variable when establishing the socket connection to the PureWeb server. Defaults to localhost (127.0.0.1)

  • PUREWEB_STARTUP_URL: The PureWeb server sets this variable to the URL that was used to start the service, including any URL parameters. The service can retrieve and parse the value to recover the parameters.