# Службы обмена сообщениями

{% hint style="warning" %}
Это раздел расширенной настройки, вы должны знать, что делаете, прежде чем редактировать его!
{% endhint %}

### Обзор

Этот раздел позволяет вам определить, как взаимодействуют ваши игровые серверы и ваш прокси-сервер. По умолчанию мы используем сообщения плагинов, которые интегрированы в BungeeCord и Velocity. Это позволяет программному обеспечению взаимодействовать без какой-либо дополнительной настройки.

Первый параметр, называемый `server-id`, - это, по сути, то, как ваш сервер назван в вашей конфигурации прокси-сервера, вы можете изменить его на любой, какой захотите, но он **ДОЛЖЕН** оставаться уникальным.

Связь между вашим прокси-сервером и игровыми серверами действительно важна, это позволит нашему программному обеспечению избежать дублирования виртуальных игроков на вашем игровом сервере. Насколько это будет раздражать, если вы зайдете в свой хаб и встретите Нотча, а когда вы зайдете на свой сервер выживания, вы также встретите Нотча, ахах.

Доступны четыре различных сервиса обмена сообщениями:

* Cloud - Полагается на нашу инфраструктуру для обеспечения правильной связи серверов
* Database - Использует базу данных sql для обеспечения взаимодействия серверов
* Proxy - использует встроенную в ваш прокси систему обмена сообщениями
* Redis - Полагается на программное обеспечение [redis](https://redis.com)

{% hint style="danger" %}

#### Внимание!

Вам нужно убедиться, что все ваши прокси-серверы и игровые серверы используют одну и ту же службу обмена сообщениями.
{% endhint %}

По умолчанию PlayerPoof использует облачную службу обмена сообщениями, так как она самая надежная и подключи и играй, тебе не нужно ничего делать, мы заботимся об этом :tada:

```yaml
# +-------------------------------------------------------------------------+ #
# |                                                                         | #
# |                           MESSAGING SETTINGS                            | #
# |                                                                         | #
# |             Controls how data are sent across your network.             | #
# |                                                                         | #
# +-------------------------------------------------------------------------+ #

# This is your unique server identifier, this MUST be
# set if using a proxy - e.g. BungeeCord, Velocity, ...
server-id: "server1"

# How the plugin should send data across your network.
#
# - Possible options:
#  |=> cloud (default)
#  |=> database
#  |=> proxy
#  |=> redis (recommended)
#
# If you choose redis, you must configure the redis settings below.
# If you choose proxy, no further configuration is required.
# If you choose database, you must configure the database settings below.
messaging-service: cloud
```

#### Database

```yaml
# +-------------------------------------------------------------------------+ #
# |                                                                         | #
# |                            DATABASE SETTINGS                            | #
# |                                                                         | #
# +-------------------------------------------------------------------------+ #
storage:
  # How the plugin should store data
  #
  # - Possible options:
  #   |=> MySQL
  #   |=> MariaDB (preferred over MySQL)
  #   |=> PostgreSQL
  type: mysql

  # Define the address for the database.
  host: 127.0.0.1

  # Define the port for the database.
  # - The standard DB engine port is used by default
  #   (MySQL: 3306, PostgreSQL: 5432, MongoDB: 27017)
  port: 3306

  # The name of the database to store PlayerPoof data in.
  # - This must be created already. Don't worry about this setting if you're using MongoDB.
  database: 'playerpoof'

  # Credentials for the database.
  username: root
  password: 'MySuperSecurePassword'

  # These settings apply to the MySQL connection pool.
  # - The default values will be suitable for the majority of users.
  # - Do not change these settings unless you know what you're doing!
  pool-settings:
    # Sets the maximum size of the MySQL connection pool.
    # - Basically this value will determine the maximum number of actual
    #   connections to the database backend.
    # - More information about determining the size of connection pools can be found here:
    #   https://github.com/brettwooldridge/HikariCP/wiki/About-Pool-Sizing
    maximum-pool-size: 10

    # Sets the minimum number of idle connections that the pool will try to maintain.
    # - For maximum performance and responsiveness to spike demands, it is recommended to not set
    #   this value and instead allow the pool to act as a fixed size connection pool.
    #   (set this value to the same as 'maximum-pool-size')
    minimum-idle: 10

    # This setting controls the maximum lifetime of a connection in the pool in milliseconds.
    # - The value should be at least 30 seconds less than any database or infrastructure imposed
    #   connection time limit.
    maximum-lifetime: 1800000 # 30 minutes

    # This setting controls how frequently the pool will 'ping' a connection in order to prevent it
    # from being timed out by the database or network infrastructure, measured in milliseconds.
    # - The value should be less than maximum-lifetime and greater than 30000 (30 seconds).
    # - Setting the value to zero will disable the keepalive functionality.
    keep-alive-time: 0

    # This setting controls the maximum number of milliseconds that the plugin will wait for a
    # connection from the pool, before timing out.
    connection-timeout: 5000 # 5 seconds

    # This setting allows you to define extra properties for connections.
    #
    # By default, the following options are set to enable utf8 encoding. (you may need to remove
    # these if you are using PostgreSQL)
    #   useUnicode: true
    #   characterEncoding: utf8
    #
    # You can also use this section to disable SSL connections, by uncommenting the 'useSSL' and
    # 'verifyServerCertificate' options below.
    properties:
      useUnicode: true
      characterEncoding: utf8
      #useSSL: false
      #verifyServerCertificate: false
```

#### Redis

```yaml
# +-------------------------------------------------------------------------+ #
# |                                                                         | #
# |                             REDIS SETTINGS                              | #
# |                                                                         | #
# +-------------------------------------------------------------------------+ #
redis:
  address: 127.0.0.1
  port: 6379
  password: ''
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.playerpoof.com/languages/russian/ustanovka/sluzhby-obmena-soobsheniyami.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
