# PluginConnection

Roblox Engine API class from Roblox Studio 0.744.0.7441077 (version-7aaa6838d36c4448).

- Inherits from, nearest first: [Object](https://rapi.sleaze.dev/classes/Object.md)
- Tags: Not creatable, Not replicated
- Memory category: Instances
- HTML page: https://rapi.sleaze.dev/classes/PluginConnection/
- Roblox documentation: https://create.roblox.com/docs/reference/engine/classes/PluginConnection

Encapsulates a connection between the current data model and another for plugin communication.

## Properties

### Connected

```luau
PluginConnection.Connected: boolean
```

- Tags: Read only, Plugin security

Whether this [`PluginConnection`](https://rapi.sleaze.dev/classes/PluginConnection.md) object is still connected.

### GroupId

```luau
PluginConnection.GroupId: string
```

- Tags: Hidden, Not scriptable, Read only, Roblox engine security

### TargetId

```luau
PluginConnection.TargetId: string
```

- Tags: Read only, Plugin security

A unique ID for the target data model.

### Type

```luau
PluginConnection.Type: Enum.PluginConnectionTargetType
```

- Tags: Read only, Plugin security

This `PluginConnectionTargetType` describes the relationship of the target data model to the current one.

## Methods

### BindToMessage

```luau
PluginConnection:BindToMessage(callbackFunction: (...any) -> ...any): RBXScriptConnection
```

- Tags: Plugin security

Binds a callback to this [`PluginConnection`](https://rapi.sleaze.dev/classes/PluginConnection.md) to receive messages from [`SendMessage()`](https://rapi.sleaze.dev/classes/PluginConnection.md).

Returns: A [`RBXScriptConnection`](https://rapi.sleaze.dev/index/types/RBXScriptConnection.md) representing the binding of this callback to the [`PluginConnection`](https://rapi.sleaze.dev/classes/PluginConnection.md). Disconnect it to disconnect this callback from the connection.

### SendMessage

```luau
PluginConnection:SendMessage(message: any)
```

- Tags: Plugin security

Sends a payload to the remote data model.

Parameters:

- `message`: The string or buffer to be sent.

## Inherited members

- From [Object](https://rapi.sleaze.dev/classes/Object.md): `ClassName`, `className`, `GetPropertyChangedSignal`, `IsA`, `isA`, `Changed`
