Quick Start & Best Practices
This guide will help you get connected to the RMS-Socket WebSocket service quickly and learn recommended practices for production environments.
What's covered in this page:
Minimal connection example to get started immediately
Step-by-step connection lifecycle
Production-ready best practices for reliability and security
Code Examples Language:
All examples on this page use JavaScript (Node.js) with the socket.io-client library. For complete examples in other languages (Python, Browser), see the Code Examples page.
Quick Start
Get connected in under 5 minutes with this minimal JavaScript example.
Prerequisites
Node.js installed
Socket.IO client library: `npm install socket.io-client`
Your Customer ID (provided by LSports)
Valid access token from ARENA360 Authentication Guide
Minimal Connection Example
Connection Lifecycle
Understanding the connection lifecycle ensures your application handles all states correctly.
1. Connect
Establish WSS connection with authentication headers. Upon successful connection, the server sends an announcements event:
2. Join Room
After connection, emit the join event to join your designated room:
3. Receive Messages
Listen for events on your subscribed room and receive real-time events:
4. Handle Disconnection
Handle graceful disconnection and reconnection:
Best Practices
Follow these recommendations for a robust, production-ready implementation.
Security Recommendations
Use WSS (TLS) - Always use secure WebSocket connections
Always use
wss://for encrypted connectionsNever use unencrypted
ws://in production
Use Short-Lived Tokens - Enable auto-reconnection with exponential backoff
Access tokens expire every 30 minutes
Implement automatic token refresh before expiration
Never hardcode tokens in client-side code
re-emit
joinevent after reconnecting
Secure Token Storage
Store tokens securely (environment variables, secure storage)
Never expose tokens in URLs or query strings
Never hardcode tokens in client-side code
Rotate tokens regularly
Validate Origins
For browser clients, ensure your domain is whitelisted
Contact LSports to configure CORS for your domains
Recommended Settings
Reconnection Strategy
Token Refresh Before Expiration
Connection Health Monitoring
Last updated
Was this helpful?