Skip to content

Latest commit

 

History

History
41 lines (26 loc) · 2.35 KB

File metadata and controls

41 lines (26 loc) · 2.35 KB

WsMini Documentation

Welcome to the documentation for WsMini, a lightweight WebSocket library for real-time applications with RPC, PubSub, Rooms and Game state synchronization. WsMini is designed for small web games and real-time applications with a focus on simplicity and ease of use:

  • Authentication & Security: Supports token transmission during handshake and basic WebSocket security. User accounts, rate limiting, and additional security checks should be handled by your application
  • Scalability: Targeted for small to medium applications, scaling features are outside the scope

npm version License: MIT

Security Considerations

WsMini provides basic security features but requires additional implementation for production use:

  • Origin Validation: The library includes origin checking capabilities to prevent unauthorized cross-origin connections. This should always be configured in production environments.
  • Rate Limiting: Not included in WsMini - implement rate limiting at the application or reverse proxy level to prevent abuse.
  • Token Authentication: Supports token transmission during WebSocket handshake. Tokens can be JWT tokens or any string format that your application uses for user authentication. Token validation logic must be implemented in your application.

Documentation

API Reference

Client API

  • WSClient - Core WebSocket client for RPC, PubSub, and server commands
  • WSClientRoom - Room-based WebSocket client extending WSClient

Server API

  • WSServer - Base WebSocket server class (use WSServerPubSub or WSServerRoomManager instead)
  • WSServerPubSub - WebSocket server with PubSub/RPC capabilities
  • WSServerRoomManager - Room-based WebSocket server extending WSServerPubSub
  • WSServerGameRoom - Game room with fixed timestep loop and state synchronization

License

This project is licensed under the MIT License - see the LICENSE file for details.