hashload/horse/horse-websocket

Claude Code and agent skill by hashload/horse

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Guidelines and workflows for developing and maintaining WebSocket endpoints and protocol upgrades within the Horse framework.

Install

npx vskill@latest install hashload/horse/horse-websocket

SKILL.md

The same SKILL.md was published earlier as hashload/horse/horse-websocket.

Horse WebSocket Coding Skill

This skill provides guidelines and patterns for developers and AI agents implementing, debugging, or maintaining WebSocket endpoints in the Horse framework.

🟢 Request Upgrade Pattern

To upgrade an HTTP request to a WebSocket connection, always call Res.UpgradeToWebSocket(AOnConnectCallback) inside the route handler.

Delphi Syntax (Anonymous Procedure / Closure)
delphi
THorse.Get('/ws',
procedure(Req: THorseRequest; Res: THorseResponse)
begin
Res.UpgradeToWebSocket(
procedure(const AConn: IHorseWebSocketConnection)
begin
AConn.OnMessage := procedure(const AConnection: IHorseWebSocketConnection; const AText: string)
begin
AConnection.SendText('Received: ' + AText);
end;
end);
end);
Lazarus/FPC Syntax (Object Methods)

Always use regular object methods or class procedures for callbacks in Lazarus/FPC to ensure compatibility:

pascal
type
TWebSocketController = class
public
class procedure HandleWS(Req: THorseRequest; Res: THorseResponse);
class procedure OnConnect(const AConn: IHorseWebSocketConnection);
class procedure OnMessage(const AConnection: IHorseWebSocketConnection; const AText: string);
end;
class procedure TWebSocketController.HandleWS(Req: THorseRequest; Res: THorseResponse);
begin
Res.UpgradeToWebSocket(OnConnect);
end;
class procedure TWebSocketController.OnConnect(const AConn: IConn);
begin
AConn.OnMessage := OnMessage;
end;
class procedure TWebSocketController.OnMessage(const AConnection: IHorseWebSocketConnection; const AText: string);
begin
AConnection.SendText('Received: ' + AText);
end;

🟢 Broadcasts and Session Management

Use THorseWebSocketManager for thread-safe operations across multiple connections.

  • Broadcast to all: THorseWebSocketManager.Broadcast('/ws', 'Hello all!');
  • Broadcast excluding sender: THorseWebSocketManager.Broadcast('/ws', 'Hello others!', AConnection);

🟢 Error and Exception Handling

  • Silencing normal interruptions: Normal connection validation errors or manual status sends followed by pipeline interruption should raise EHorseCallbackInterrupted (from unit Horse.Exception.Interrupted) to gracefully exit the middleware pipeline.
  • Callback Safety: Always place try-except blocks inside custom event handlers (like OnMessage) to prevent crashes inside the worker socket threads.
  • Fail-Fast Detection: If a client requests a WebSocket upgrade on an unsupported provider (e.g. HttpSys or hosted ISAPI/CGI), Res.UpgradeToWebSocket will automatically reply with 501 Not Implemented and raise EHorseCallbackInterrupted.

🟢 Thread-Safety Rules

  1. IHorseWebSocketConnection.SendText and SendBinary are thread-safe and protected by an internal TCriticalSection. Do not add manual synchronization wrappers around them.
  2. The HTTP request/response objects (THorseRequest, THorseResponse) are recycled/destroyed once the upgrade is completed. Do not store or reference them inside any of the WebSocket callbacks (OnMessage, OnDisconnect, etc.). Use the IHorseWebSocketConnection context instead.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
1,368
Repository forks
244
7-day trend score
36

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/hashload/horse/horse-websocket/badge)](https://verified-skill.com/skills/hashload/horse/horse-websocket)

Something wrong with this skill or its page? Tell us.