Server Setup Overview
When using the custom backend option, you need to deploy a server to handle friend data. Universal Friend List includes two server implementations: a Node.js server with WebSocket support and a PHP server for simpler hosting.
Choosing a Server Type
| Feature | Node.js Server | PHP Server |
|---|---|---|
| Transport | WebSocket + HTTP REST | HTTP REST only |
| Real-time Updates | Yes (WebSocket) | No (polling only) |
| Database | SQLite (default) | SQLite or MySQL |
| Scaling | Horizontal (with sticky sessions) | Single server / shared hosting |
| Hosting | Node.js hosting required | Standard PHP hosting |
| Best For | Production, real-time needs | Simple projects, shared hosting |
When Is a Server Needed?
You need a server when:
- Using Mirror, Unity Netcode, or FishNet
- Using Custom Backend option with Photon
- You need cross-platform friends
- You need server-side moderation
- Your game has dedicated servers
You may NOT need a server when:
- Using Photon PUN or Fusion with Native Implementation
- Prototyping without real multiplayer
Architecture Overview
Both servers provide the same REST API endpoints for friend operations. The Node.js server additionally provides WebSocket for real-time events:
Unity Client
│
└── FriendManager
│
└── INetworkFriendSystem
│
└── CustomBackendFriendSystem
│
├── BlinkBoxServerClient HTTP
│
└── BlinkBoxWebSocketClient WS
↓ REST calls / WebSocket
Server
├── Node.js: REST + WebSocket
└── PHP: REST only
↓ Database
Database
├── SQLite Node.js default
└── MySQL PHP option
Server-Specific Documentation
- Node.js Server - Full setup, configuration, and deployment
- PHP Server - Setup for shared hosting environments
- WebSocket Protocol - Real-time communication details
- Database Schema - Database structure and tables
Security Considerations
Important: These are sample servers for development and prototyping. Before production deployment:
- Use HTTPS/WSS in production
- Implement proper authentication tokens
- Add rate limiting to prevent abuse
- Validate all user input server-side
- Use production-grade database connections
- Consider input sanitization for SQL queries