📡
Soketi
0.x
0.x
  • 📡soketi
  • 🏆Benchmarks
  • 🎉Support
  • 🤝Contributing
  • 😢Known Limitations
  • Getting started
    • 🚀Installation
      • CLI Installation
      • Docker
      • Helm Charts
      • Laravel Sail (Docker)
    • 💿Configuring the server
    • 🔐SSL Configuration
    • 🎨Client Configuration
      • Pusher SDK
      • Laravel Echo
    • 💻Backend Configuration
      • Pusher SDK
      • Laravel Broadcasting
      • Nginx Configuration
    • 🧠Redis Configuration
  • App Management
    • 🎟️Introduction
    • 🧬Array Driver
    • 🛢️SQL Drivers
      • 🐬MySQL
      • 🐘PostgreSQL
      • ⛲Database Pooling
    • 👾DynamoDB
  • Rate Limiting & Limits
    • ⛔Broadcast Rate Limiting
    • 👥Events & Channels Limits
  • Advanced Usage
    • ↔️Horizontal Scaling
      • 🤖Running Modes
      • 🧠Redis Configuration
      • 🧙‍♂️🧙♂ 🧙♂ 🧙♂ NATS Configuration
      • 🗃️Private Network Configuration
      • 😑Ok, what to choose?
    • 🛑Graceful Shutdowns & Real-time monitoring
    • 📈Prometheus Metrics
    • 🔗HTTP Webhooks
      • 📐AWS Lambda trigger
    • 🕛Queues
      • ⛓️AWS SQS FIFO
      • 🧠Redis
  • Network Watcher
    • 🚀Installation
    • 💿Environment Variables
Powered by GitBook
On this page
  • Environment Variables
  • Limits on an app-by-app basis

Was this helpful?

Edit on GitHub
  1. App Management
  2. SQL Drivers

MySQL

PreviousSQL DriversNextPostgreSQL

Last updated 3 years ago

Was this helpful?

When using the MySQL app driver, first you should configure your MySQL connection credentials as :

Name
Default
Possible values
Description

DB_MYSQL_HOST

127.0.0.1

Any string

The MySQL host.

DB_MYSQL_PORT

3306

Any integer

The MySQL port.

DB_MYSQL_USERNAME

root

Any string

The MySQL username.

DB_MYSQL_PASSWORD

password

Any string

The MySQL password.

DB_MYSQL_DATABASE

main

Any string

The MySQL database.

This database supports .

Once you have configured your MySQL database credentials, you should create a table with the following structure:

CREATE TABLE IF NOT EXISTS `apps` (
    `id` varchar(255) NOT NULL,
    `key` varchar(255) NOT NULL,
    `secret` varchar(255) NOT NULL,
    `max_connections` integer(10) NOT NULL,
    `enable_client_messages` tinyint(1) NOT NULL,
    `enabled` tinyint(1) NOT NULL,
    `max_backend_events_per_sec` integer(10) NOT NULL,
    `max_client_events_per_sec` integer(10) NOT NULL,
    `max_read_req_per_sec` integer(10) NOT NULL,
    `webhooks` json,
    PRIMARY KEY (`id`)
);

Environment Variables

The following environment variables are used to define the behavior of the MySQL app driver:

Name
Default
Possible values
Description

APP_MANAGER_MYSQL_TABLE

apps

Any string

The table to pull the app data from.

APP_MANAGER_MYSQL_VERSION

8.0

Any string

The MySQL version (utilized by the underlying Knex database abstraction layer).

APP_MANAGER_MYSQL_USE_V2

false

true, false

soketi 0.14+. If you're using MySQL 8.0+ and experience authentication issues, you may enable this option.

Limits on an app-by-app basis

This feature is truly optional. To enforce app-level limits in MySQL, you should add the following fields to your table:

`max_presence_members_per_channel` tinyint(1) NULL,
`max_presence_member_size_in_kb` tinyint(1) NULL,
`max_channel_name_length` tinyint(1) NULL,
`max_event_channels_at_once` tinyint(1) NULL,
`max_event_name_length` tinyint(1) NULL,
`max_event_payload_in_kb` tinyint(1) NULL,
`max_event_batch_size` tinyint(1) NULL

Existing apps running on <0.29.0 will still work even if you don't have these fields added after the migration to 0.29.0. You should add these fields to keep your database up-to-date or to have the choice to, later on, imply limits to your apps.

Setting any of them to null or '' will ignore the setting, and use the limits associated .

🛢️
🐬
environment variables
database connection pooling
with the server-level declared defaults