soketi
  • 📡soketi
  • 🏆Benchmarks
  • 🎉Support
  • 🤝Contributing
  • 📼Video Courses
  • 😢Known Limitations
  • Getting started
    • ⬆️Upgrading from 0.x
    • 🚀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
    • 📝Caching
    • ⚛️User Authentication
    • 🤾Enhancing Performance
      • 🔀New traffic redirection
  • Network Watcher
    • 🚀Installation
    • 💿Environment Variables
由 GitBook 提供支持
在本页
在GitHub上编辑
  1. Advanced Usage

User Authentication

上一页Caching下一页Enhancing Performance

最后更新于2年前

Pusher allows you to before deciding if the server should keep the connection or not. In this sense, Soketi allows you to authenticate the users of your app too. It also takes care of automatically.

All apps have this feature disabled by default, and you can decide for each app if this should be enabled or not.

By default, when the app has user authentication enabled, Soketi disconnects unauthenticated or unauthorized connections in 30 seconds. However, you can change this duration using the following environment variable:

# 5 seconds timeout
SOKETI_USER_AUTHENTICATION_TIMEOUT=5000 soketi start

Send message to specific user ID

With the help of the new HTTP API endpoint, Soketi can also allow you to send a message specific to an user id. This feature is implemented on all SDKs and you can see a JS sample below.

The SDKs namings differ, so ensure you use the latest SDK version for your language.

pusher.sendToUser('1', 'order-shipped', {
    id: 'A2BQW2',
    items: [{
        name: 'Iphone',
    }],
});

Terminate specific user's connections

Soketi supports terminating a user's connections after it was authenticated. It stays in sync with Pusher's protocol and most of the SDKs are already implementing a method for this functionality. Ensure you use the latest SDK version for your language.

pusher.terminateUserConnections('1');
⚛️
authenticate the users attempting to connect to the websockets
authorized connections
Read more about the app management where you can enable the user authentication.