Skip to content
Back to skills

Laravel Websocket

ASecurity

Use when building Laravel real-time features — Broadcasting events, ShouldBroadcast, private/presence channels, Echo client. For non-Laravel WebSockets, use the stack-native skill.

  • 10 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added June 5, 2026
ai-agentsrustgophpapi

Works with

  • cli
  • api

Security analysis

A100/100

Scanned June 5, 2026

npx -y skills add event4u-app/agent-config --skill laravel-websocket --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Laravel Websocket?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Laravel Websocket
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/event4u-app-laravel-websocket/badge)](https://www.skillsdirectory.com/skills/event4u-app-laravel-websocket)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
model_tier: medium
name: laravel-websocket
description: "Use when building Laravel real-time features — Broadcasting events, ShouldBroadcast, private/presence channels, Echo client. For non-Laravel WebSockets, use the stack-native skill."
domain: engineering
framework: laravel
workspaces:
  - engineering
packs:
  - laravel
trust:
  level: professional
install:
  default: false
  removable: true
---

# laravel-websocket

## When to use

Use when implementing real-time features — WebSockets, Broadcasting, or persistent connections.

Do NOT use when:
- REST API endpoints (use `api-design` skill)
- Reverb server setup/deployment (use `laravel-reverb` skill)

## Procedure: Create a broadcast event

### Step 0: Inspect

1. Check `config/broadcasting.php` for driver (Reverb, Pusher, Ably).
2. Check existing broadcast events — match patterns.
3. Check `routes/channels.php` for channel authorization.

### Step 1: Create event class

1. Implement `ShouldBroadcast`.
2. Define `broadcastOn()` with appropriate channel type (public/private/presence).
3. Define `broadcastAs()` for event name.
4. Define `broadcastWith()` — small payload (IDs + changed fields only).

### Step 2: Authorize channel

Add authorization in `routes/channels.php` for private/presence channels.

### Step 3: Client setup

Use Laravel Echo to listen on the channel. Wire up reconnection with exponential backoff.

## Conventions

→ See guideline `php/websocket.md` for broadcasting setup, channel types, connection management, Echo.

### Validate

- Verify private/presence channels have authorization in `routes/channels.php`.
- Confirm event implements `ShouldBroadcast` (or `ShouldBroadcastNow`).
- Check that no sensitive data is broadcast on public channels.
- Test client receives event — use browser console or Echo debug mode.

## Output format

1. Event class with broadcastOn() and channel definitions
2. Client-side listener integration code

## Gotcha

- Connections are stateful — don't assume they persist after page navigation.
- Always implement reconnection with exponential backoff.
- Don't broadcast sensitive data on public channels — use private/presence.

## Do NOT

- Do NOT send entire model objects — select only needed fields.
- Do NOT skip channel authorization for user-specific data.
- Do NOT rely on WebSocket delivery — use acknowledgments for critical messages.

## Auto-trigger keywords

- WebSocket
- real-time
- broadcasting
- Laravel Echo
- channel authorization
- ShouldBroadcast

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.