peerpigeon 0.1.1 ā 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +141 -1365
- package/cli.js +1382 -0
- package/dist/peerpigeon-browser.js +12450 -0
- package/dist/peerpigeon-browser.js.map +7 -0
- package/docs/API_DOCUMENTATION.md +1976 -0
- package/docs/BOOTSTRAP_HUBS.md +319 -0
- package/docs/CLI_README.md +371 -0
- package/docs/CUSTOM_HUB_NAMESPACES.md +182 -0
- package/docs/CUSTOM_NAMESPACE_IMPLEMENTATION.md +187 -0
- package/docs/DOCUMENTATION_REORGANIZATION.md +172 -0
- package/docs/HUB_QUICK_REF.md +108 -0
- package/docs/HUB_SCRIPTS.md +341 -0
- package/docs/HUB_SYSTEM.md +599 -0
- package/docs/MIGRATION_COMPLETE.md +93 -0
- package/docs/NETWORK_NAMESPACES.md +212 -0
- package/docs/PIGEONRTC_MIGRATION.md +280 -0
- package/docs/README.md +108 -0
- package/docs/SELECTIVE_STREAMING_GUIDE.md +427 -0
- package/docs/TEST_CLEANUP_COMPLETE.md +80 -0
- package/examples/bootstrap-hub-example.js +292 -0
- package/examples/browser/README.md +278 -0
- package/examples/browser/app.js +2426 -49
- package/examples/browser/index.html +481 -630
- package/examples/browser/minimal/README.md +55 -0
- package/examples/browser/minimal/index.html +75 -0
- package/examples/browser/minimal/minimal.js +234 -0
- package/examples/browser/styles.css +687 -1425
- package/examples/browser/test-bundle.html +35 -0
- package/examples/browser-2/index.html +30 -0
- package/examples/browser-2/package.json +21 -0
- package/examples/browser-2/src/App-simple.vue +21 -0
- package/examples/browser-2/src/App.vue +420 -0
- package/examples/browser-2/src/components/CryptoView.vue +1661 -0
- package/examples/browser-2/src/components/DHTView.vue +1281 -0
- package/examples/browser-2/src/components/DebugView.vue +1773 -0
- package/examples/browser-2/src/components/MediaView.vue +1048 -0
- package/examples/browser-2/src/components/MessagingView.vue +775 -0
- package/examples/browser-2/src/components/NetworkView.vue +930 -0
- package/examples/browser-2/src/components/StorageView.vue +1376 -0
- package/examples/browser-2/src/main.js +5 -0
- package/examples/browser-2/src/stores/peerpigeon.js +895 -0
- package/examples/browser-2/vite.config.js +6 -0
- package/examples/hub-example.js +189 -0
- package/examples/multi-hub-test.js +186 -0
- package/examples/node/README.md +2 -2
- package/examples/programmatic-namespace-example.js +108 -0
- package/examples/selective-streaming-demo.html +698 -0
- package/examples/standard-events-demo.js +126 -0
- package/index.js +7 -1
- package/package.json +34 -16
- package/server/index.js +1058 -98
- package/server/start.js +52 -0
- package/src/ConnectionManager.js +239 -225
- package/src/CryptoManager.js +147 -18
- package/src/DebugLogger.js +0 -7
- package/src/DistributedStorageManager.js +224 -205
- package/src/EnvironmentDetector.js +88 -4
- package/src/EventEmitter.js +79 -1
- package/src/EvictionManager.js +10 -9
- package/src/GossipManager.js +163 -11
- package/src/MediaManager.js +12 -2
- package/src/PeerConnection.js +343 -311
- package/src/PeerPigeonMesh.js +576 -135
- package/src/PigeonRTC-browser.js +247 -0
- package/src/SignalingClient.js +14 -243
- package/src/SignalingHandler.js +31 -10
- package/src/StorageManager.js +0 -39
- package/src/WebDHT-Simple.js +389 -0
- package/src/WebDHT.js +363 -1165
- package/src/browser-entry.js +58 -0
- package/examples/browser/assets/images/favicon.png +0 -0
- package/examples/browser/assets/images/pigeon.png +0 -0
- package/examples/browser/crypto-test.html +0 -427
- package/examples/browser/ui-old.js +0 -1926
- package/examples/browser/ui.js +0 -3391
- package/websocket-server/README.md +0 -247
- package/websocket-server/server.js +0 -391
package/server/start.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { PeerPigeonServer } from './index.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Standalone PeerPigeon WebSocket Server
|
|
6
|
+
*
|
|
7
|
+
* Environment variables:
|
|
8
|
+
* - PORT: Server port (default: 3000)
|
|
9
|
+
* - HOST: Server host (default: localhost)
|
|
10
|
+
* - MAX_CONNECTIONS: Maximum connections (default: 1000)
|
|
11
|
+
* - CORS_ORIGIN: CORS origin (default: *)
|
|
12
|
+
* - HUB_MESH_NAMESPACE: Hub network namespace (default: pigeonhub-mesh)
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const port = parseInt(process.env.PORT || '3000', 10);
|
|
16
|
+
const host = process.env.HOST || 'localhost';
|
|
17
|
+
const maxConnections = parseInt(process.env.MAX_CONNECTIONS || '1000', 10);
|
|
18
|
+
const corsOrigin = process.env.CORS_ORIGIN || '*';
|
|
19
|
+
const hubMeshNamespace = process.env.HUB_MESH_NAMESPACE || 'pigeonhub-mesh';
|
|
20
|
+
|
|
21
|
+
const server = new PeerPigeonServer({
|
|
22
|
+
port,
|
|
23
|
+
host,
|
|
24
|
+
maxConnections,
|
|
25
|
+
corsOrigin,
|
|
26
|
+
hubMeshNamespace,
|
|
27
|
+
isHub: false // Regular signaling server by default
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Handle errors
|
|
31
|
+
server.on('error', (error) => {
|
|
32
|
+
console.error('ā Server error:', error);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// Handle shutdown gracefully
|
|
36
|
+
process.on('SIGINT', async () => {
|
|
37
|
+
console.log('\nš Received SIGINT, shutting down gracefully...');
|
|
38
|
+
await server.stop();
|
|
39
|
+
process.exit(0);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
process.on('SIGTERM', async () => {
|
|
43
|
+
console.log('\nš Received SIGTERM, shutting down gracefully...');
|
|
44
|
+
await server.stop();
|
|
45
|
+
process.exit(0);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Start the server
|
|
49
|
+
server.start().catch((error) => {
|
|
50
|
+
console.error('ā Failed to start server:', error);
|
|
51
|
+
process.exit(1);
|
|
52
|
+
});
|