Skip to content

xp_rpc: NWNX4's Modern RPC Plugin

Scott Munday edited this page Sep 20, 2021 · 2 revisions

Overview

xp_rpc is a plugin that allows high performance RPC communication between an NWN2 server and any set of microservices. A microservice can be built in any supported language of both gRPC and Protocol Buffers.

Why Use the Plugin?

In the past, plugins were designed with a domain-oriented approach (i.e. data, health, system). The xp_rpc plugin potentially allows a more application-oriented approach. All domains (authentication, data, etc.) can now exist inside a scalable, distributable, performant microservice running on practically any environment fully (or partially) decoupled from the server itself.

How Does It Work

The plugin uses a handful of protobuf messages and services to build a data contract between itself and the service. A microservice can then be developed in any supported language with a thorough definition of the service implementation. A YAML configuration should then be manually set with the list of the service names and their respective paths. With the NWNX4 application running with the xp_rpc plugin, the application is ready to transmit requests to the microservice.

All that will be left is to send requests through the module using NWScript.

NWNXSetString("RPC", "TestService", "foo", 0, "bar");

In the example, "RPC" is the plugin, "TestService" is the name of the service defined for xp_rpc, and the rest is data sent as part of the request. The microservice should take the request and respond to it appropriately.

Clone this wiki locally