Startempire Wire Network Websockets
Plugin to provide websocket support for the Startempire Wire Network. WordPress-based, server-agnostic, able integrate with any server. Handles real-time features like chat, notifications, and data syncing.
Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/startempire-wire/startempire-wire-network-websockets/archive/refs/heads/master.zipEnterprise-grade WebSocket solution for WordPress with real-time communication features.
Overview
The Startempire Wire Network WebSocket Plugin provides real-time communication capabilities for the Startempire Wire Network ecosystem. It enables live updates, chat functionality, and network-wide data synchronization through a robust WebSocket server implementation.
Features
- Real-time Communication: Enable instant messaging and live updates across the network
- Discord Integration: Seamless integration with Discord for community engagement
- Network Synchronization: Real-time data synchronization between network members
- Scalable Architecture: Support for thousands of concurrent connections
- Secure Communication: SSL/TLS encryption and JWT authentication
- Admin Dashboard: Comprehensive monitoring and management interface
- Performance Metrics: Real-time statistics and historical data analysis
- API Integration: REST and WebSocket APIs for custom integrations
- Server Agnostic: Can be used on any server or service
- AsyncAPI Support: Uses AsyncAPI to describe WebSocket-based APIs
Requirements
- PHP 7.4 or higher
- WordPress 5.8 or higher
- Node.js 14.x or higher
- SSL certificate for production use
- Redis (optional, for enhanced caching)
Installation
Standard Installation
- Upload plugin files to
/wp-content/plugins/ - Activate through WordPress admin
- Install Node.js dependencies:
cd wp-content/plugins/startempire-wire-network-websockets/node-server npm install --production
Local by Flywheel Installation
- Follow standard installation steps 1-2
- Access Local by Flywheel shell:
- Right-click your site
- Select "Open Site Shell"
- Navigate to plugin directory:
cd wp-content/plugins/startempire-wire-network-websockets/node-server - Install dependencies:
npm install --production - Configure environment:
cp .env.example .env - Edit .env file to use alternative port:
WP_PORT=8081 # Use lower port number for Local by Flywheel - Add to wp-config.php:
define('SEWN_WS_DEFAULT_PORT', 8081); // Override default port define('SEWN_WS_ENV_LOCAL_MODE', true); // Enable local mode
Port Configuration
The plugin supports two methods for configuring the WebSocket port:
-
Recommended (Current):
define('SEWN_WS_DEFAULT_PORT', 49200); // In wp-config.php -
Legacy (Deprecated):
define('SEWN_WS_ENV_DEFAULT_PORT', 8081); // Will be removed in v2.0.0
Starting the Server
Standard Environment
wp sewn-ws server start
Local by Flywheel
- Access site shell
- Start server with debug mode:
wp sewn-ws server start --debug - Monitor logs:
tail -f /var/log/websocket.log
Troubleshooting Local by Flywheel Installation
If the server starts but immediately stops:
-
Check Port Availability:
netstat -tulpn | grep 8081 -
Verify Process:
ps aux | grep "node.*sewn-ws" -
Check Permissions:
ls -la wp-content/plugins/startempire-wire-network-websockets/node-server -
Review Logs:
tail -f /var/log/websocket.log -
Test Connection:
telnet localhost 8081
Common Solutions:
- Use port 8081 instead of 49200
- Enable debug mode for detailed logs
- Check file permissions in node-server directory
- Verify Node.js installation in Local by Flywheel
- Ensure no other services use the configured port
Documentation
Core Documentation
Additional Resources
Support
Community Support
Professional Support
- Email: support@startempirewire.com
- Priority Support: https://startempirewire.com/support
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the GPL v3 - see the LICENSE file for details.
Changelog
1.0
- Initial release
- Core WebSocket implementation
- External Service Integration
0.5
- Beta release
- Basic WebSocket functionality
- Admin dashboard prototype
Upgrade Notice
1.0
Major Update - Requires Node.js 14.x+ and PHP 7.4+. Includes new security features.
0.5
Initial beta release - Not recommended for production use.
Acknowledgments
- Ratchet - WebSocket server library
- React - UI library
- WordPress - Content management system
- Node.js - JavaScript runtime
- AsyncAPI - API documentation
Integration
WordPress Integration
// Initialize WebSocket client
$ws_client = SEWN_WebSocket_Client::getInstance();
// Subscribe to updates
$ws_client->subscribe('network_updates', function($message) {
// Handle update
});
// Send message
$ws_client->send('network_updates', [
'type' => 'status_update',
'message' => 'Site updated'
]);
JavaScript Integration
// Initialize WebSocket connection
const ws = new WebSocket('wss://your-domain.com:49200');
// Authenticate
ws.onopen = () => {
ws.send(JSON.stringify({
type: 'auth',
token: 'your-jwt-token'
}));
};
// Handle messages
ws.onmessage = (event) => {
const message = JSON.parse(event.data);
// Handle message
};
Architecture
The plugin follows a modular architecture with these key components:
wp-content/plugins/startempire-wire-network-websockets/
├── admin/ # Admin interface
├── includes/ # Core plugin classes
├── node-server/ # WebSocket server
├── public/ # Public assets
└── docs/ # Documentation
Security
- All production deployments must use SSL/TLS
- Authentication required for privileged operations
- Rate limiting enforced on all endpoints
- Regular security audits recommended
Performance
- Supports 1000+ concurrent connections
- Message throughput: 10,000+ messages/second
- Memory usage: ~128MB base, ~256B per connection
- CPU usage: ~2% idle, ~10% under load
Support
Community Support
Professional Support
- Email: support@startempirewire.com
- Priority Support: https://startempirewire.com/support
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the GPL v3 - see the LICENSE file for details.