Skip to main content
The ICallGateSubscriber interface is used to call methods exposed by other plugins and subscribe to notifications from them. This is the client-side interface for inter-plugin communication.

Interface Hierarchy

The ICallGateSubscriber interface has multiple generic variants to support different numbers of parameters:
  • ICallGateSubscriber - Base interface with common functionality
  • ICallGateSubscriber<TRet> - No parameters
  • ICallGateSubscriber<T1, TRet> - One parameter
  • ICallGateSubscriber<T1, T2, TRet> - Two parameters
  • ICallGateSubscriber<T1, T2, T3, TRet> - Three parameters
  • ICallGateSubscriber<T1, T2, T3, T4, TRet> - Four parameters
  • ICallGateSubscriber<T1, T2, T3, T4, T5, TRet> - Five parameters
  • ICallGateSubscriber<T1, T2, T3, T4, T5, T6, TRet> - Six parameters
  • ICallGateSubscriber<T1, T2, T3, T4, T5, T6, T7, TRet> - Seven parameters
  • ICallGateSubscriber<T1, T2, T3, T4, T5, T6, T7, T8, TRet> - Eight parameters

Type Parameters

T1
type
The type of the first parameter
T2
type
The type of the second parameter
T3
type
The type of the third parameter
T4
type
The type of the fourth parameter
T5
type
The type of the fifth parameter
T6
type
The type of the sixth parameter
T7
type
The type of the seventh parameter
T8
type
The type of the eighth parameter
TRet
type
The return type of the function. Use object for void-like behavior

Properties

HasAction
bool
Gets a value indicating whether this IPC call gate has an associated Action registered by the provider
HasFunction
bool
Gets a value indicating whether this IPC call gate has an associated Function registered by the provider

Methods

Subscribe

void Subscribe(Action action)
void Subscribe(Action<T1> action)
void Subscribe(Action<T1, T2> action)
void Subscribe(Action<T1, T2, T3> action)
void Subscribe(Action<T1, T2, T3, T4> action)
void Subscribe(Action<T1, T2, T3, T4, T5> action)
void Subscribe(Action<T1, T2, T3, T4, T5, T6> action)
void Subscribe(Action<T1, T2, T3, T4, T5, T6, T7> action)
void Subscribe(Action<T1, T2, T3, T4, T5, T6, T7, T8> action)
Registers a delegate that will be called when the providing plugin calls SendMessage. This method can be used to receive notifications of events or data updates from a specific plugin.
action
Action
Action to subscribe. The Action’s parameters must match the generic type parameters of the interface

Unsubscribe

void Unsubscribe(Action action)
void Unsubscribe(Action<T1> action)
void Unsubscribe(Action<T1, T2> action)
void Unsubscribe(Action<T1, T2, T3> action)
void Unsubscribe(Action<T1, T2, T3, T4> action)
void Unsubscribe(Action<T1, T2, T3, T4, T5> action)
void Unsubscribe(Action<T1, T2, T3, T4, T5, T6> action)
void Unsubscribe(Action<T1, T2, T3, T4, T5, T6, T7> action)
void Unsubscribe(Action<T1, T2, T3, T4, T5, T6, T7, T8> action)
Removes a subscription created through Subscribe. Note that the delegate to be unsubscribed must be the same instance as the one passed in to Subscribe.
action
Action
Action to unsubscribe. Must be the same instance that was subscribed

InvokeAction

void InvokeAction()
void InvokeAction(T1 arg1)
void InvokeAction(T1 arg1, T2 arg2)
void InvokeAction(T1 arg1, T2 arg2, T3 arg3)
void InvokeAction(T1 arg1, T2 arg2, T3 arg3, T4 arg4)
void InvokeAction(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
void InvokeAction(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
void InvokeAction(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7)
void InvokeAction(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8)
Executes the Action registered by the provider plugin. This method is intended to be called by plugins wishing to access another plugin via RPC. The parameters passed to this method will be passed to the owning plugin, with appropriate serialization for complex data types. Primitive data types will be passed as-is. The target Action will be called on the same thread as the caller.
arg1
T1
First argument to pass to the action
arg2
T2
Second argument to pass to the action
arg3
T3
Third argument to pass to the action
arg4
T4
Fourth argument to pass to the action
arg5
T5
Fifth argument to pass to the action
arg6
T6
Sixth argument to pass to the action
arg7
T7
Seventh argument to pass to the action
arg8
T8
Eighth argument to pass to the action

InvokeFunc

TRet InvokeFunc()
TRet InvokeFunc(T1 arg1)
TRet InvokeFunc(T1 arg1, T2 arg2)
TRet InvokeFunc(T1 arg1, T2 arg2, T3 arg3)
TRet InvokeFunc(T1 arg1, T2 arg2, T3 arg3, T4 arg4)
TRet InvokeFunc(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
TRet InvokeFunc(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
TRet InvokeFunc(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7)
TRet InvokeFunc(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8)
Executes the Function registered by the provider plugin. This method is intended to be called by plugins wishing to access another plugin via RPC. The parameters passed to this method will be passed to the owning plugin, with appropriate serialization for complex data types. Primitive data types will be passed as-is. The target Function will be called on the same thread as the caller.
arg1
T1
First argument to pass to the function
arg2
T2
Second argument to pass to the function
arg3
T3
Third argument to pass to the function
arg4
T4
Fourth argument to pass to the function
arg5
T5
Fifth argument to pass to the function
arg6
T6
Sixth argument to pass to the function
arg7
T7
Seventh argument to pass to the function
arg8
T8
Eighth argument to pass to the function
return
TRet
The return value from the provider’s function

Exceptions

IpcNotReadyError

Thrown by InvokeAction and InvokeFunc when the IPC publisher has not registered an action or function yet.

Usage Examples

Calling a remote function

// Get a subscriber for a function that takes a string and returns an int
var subscriber = pluginInterface.GetIpcSubscriber<string, int>("OtherPlugin.GetLength");

// Check if the function is available
if (subscriber.HasFunction)
{
    try
    {
        // Call the remote function
        int length = subscriber.InvokeFunc("Hello World");
        Log.Information($"Length: {length}");
    }
    catch (IpcNotReadyError)
    {
        Log.Warning("The remote function is not available");
    }
}

Calling a remote action

// Get a subscriber for an action with no return value
var subscriber = pluginInterface.GetIpcSubscriber<string, int, object>("OtherPlugin.LogMessage");

// Check if the action is available
if (subscriber.HasAction)
{
    try
    {
        // Call the remote action
        subscriber.InvokeAction("Debug message", 1);
    }
    catch (IpcNotReadyError)
    {
        Log.Warning("The remote action is not available");
    }
}

Subscribing to notifications

// Get a subscriber for receiving notifications
var subscriber = pluginInterface.GetIpcSubscriber<string, object>("OtherPlugin.OnDataUpdated");

// Define a handler for notifications
void OnDataUpdated(string data)
{
    Log.Information($"Received notification: {data}");
}

// Subscribe to notifications
subscriber.Subscribe(OnDataUpdated);

// Later, when no longer needed, unsubscribe
subscriber.Unsubscribe(OnDataUpdated);

Using a subscriber with multiple parameters

// Get a subscriber for a function with multiple parameters
var subscriber = pluginInterface.GetIpcSubscriber<int, int, string, bool>(
    "OtherPlugin.ProcessData");

if (subscriber.HasFunction)
{
    try
    {
        bool result = subscriber.InvokeFunc(42, 100, "test");
        Log.Information($"Result: {result}");
    }
    catch (IpcNotReadyError)
    {
        Log.Warning("Function not ready");
    }
}

Proper cleanup pattern

public class MyPlugin : IDalamudPlugin
{
    private ICallGateSubscriber<string, object> subscriber;
    private Action<string> notificationHandler;

    public void Initialize(DalamudPluginInterface pluginInterface)
    {
        subscriber = pluginInterface.GetIpcSubscriber<string, object>(
            "OtherPlugin.OnEvent");
        
        notificationHandler = OnEventReceived;
        subscriber.Subscribe(notificationHandler);
    }

    private void OnEventReceived(string data)
    {
        Log.Information($"Event: {data}");
    }

    public void Dispose()
    {
        // Clean up subscription
        subscriber.Unsubscribe(notificationHandler);
    }
}

Notes

  • All IPC calls execute on the same thread as the caller
  • Complex data types are serialized when passed between plugins
  • Primitive data types are passed as-is
  • Check HasAction or HasFunction before invoking to avoid exceptions
  • Always handle IpcNotReadyError exceptions when calling remote methods
  • Keep a reference to the action delegate when subscribing, as you need the same instance to unsubscribe
  • Always unsubscribe when your plugin is disposed to prevent memory leaks

Build docs developers (and LLMs) love