topazcube 0.1.18 → 0.1.21
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 +61 -1
- package/dist/server.cjs +1445 -3
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +5 -0
- package/dist/server.d.ts +5 -0
- package/dist/server.js +1472 -1
- package/dist/server.js.map +1 -1
- package/package.json +8 -4
- package/src/server.ts +43 -3
package/README.md
CHANGED
|
@@ -1 +1,61 @@
|
|
|
1
|
-
|
|
1
|
+
# TopazCube
|
|
2
|
+
|
|
3
|
+
TopazCube is a real-time collaborative document editing and multiplayer game library.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install topazcube
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Basic Server Setup
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import TopazCubeServer from 'topazcube/server'
|
|
17
|
+
|
|
18
|
+
const server = new TopazCubeServer({
|
|
19
|
+
port: 8799,
|
|
20
|
+
allowWebRTC: false // WebRTC is optional
|
|
21
|
+
})
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### WebRTC Support (Optional)
|
|
25
|
+
|
|
26
|
+
WebRTC functionality is optional and requires platform-specific binary packages. If you want to use WebRTC features:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Install the appropriate platform package
|
|
30
|
+
npm install @roamhq/wrtc-darwin-x64 # for macOS x64
|
|
31
|
+
npm install @roamhq/wrtc-linux-x64 # for Linux x64
|
|
32
|
+
npm install @roamhq/wrtc-win32-x64 # for Windows x64
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Then enable WebRTC in your server:
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
const server = new TopazCubeServer({
|
|
39
|
+
port: 8799,
|
|
40
|
+
allowWebRTC: true // Enable WebRTC functionality
|
|
41
|
+
})
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Client Setup
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import TopazCubeClient from 'topazcube/client'
|
|
48
|
+
|
|
49
|
+
const client = new TopazCubeClient({
|
|
50
|
+
url: 'ws://localhost:8799'
|
|
51
|
+
})
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Features
|
|
55
|
+
|
|
56
|
+
- Real-time collaborative document editing
|
|
57
|
+
- Multiplayer game support
|
|
58
|
+
- WebSocket communication
|
|
59
|
+
- Optional WebRTC for peer-to-peer connections
|
|
60
|
+
- MongoDB integration for persistence
|
|
61
|
+
- Fast binary patches for performance
|