Code Explainers

Code explainers tagged #websockets

ruby
class ToastBroadcaster
  include ActionView::RecordIdentifier
 
  def self.broadcast_to(user, message:, type: :notice)

How Turbo Stream toasts broadcast in Rails

turbo-streams service-object real-time
Intermediate 6 steps
php
<?php
 
namespace App\Broadcasting;
 

Authorizing presence channels in Laravel

broadcasting authorization presence-channels
Intermediate 3 steps
php
<?php
 
namespace App\Http\Controllers;
 

Broadcasting typing indicators in Laravel

websockets authorization presence-channels
Intermediate 9 steps
java
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
 

Real-time chat over STOMP WebSockets in Spring

websockets stomp messaging
Intermediate 8 steps
typescript
import {
  WebSocketGateway,
  WebSocketServer,
  SubscribeMessage,

Building a real-time chat gateway in NestJS

websockets real-time socket.io
Intermediate 8 steps
rust
use axum::{
    extract::ws::{Message, WebSocket, WebSocketUpgrade},
    response::IntoResponse,
};

How an Axum WebSocket echo server works

websockets async streams protocol handling
Intermediate 8 steps
php
<?php
 
namespace App\Events;
 

How a broadcast event works in Laravel

broadcasting websockets events
Intermediate 5 steps