Skip to content

Commit 23b1198

Browse files
committed
docs: ✏️ Added readme file for the server package
1 parent fe51bb2 commit 23b1198

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

packages/server/README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# @windingtree/sdk-server
2+
3+
The Winding Tree protocol coordination server package. It enables efficient coordination among multiple peers using the libp2p networking stack.
4+
5+
## Installation
6+
7+
```bash
8+
pnpm i @windingtree/sdk-server
9+
```
10+
11+
## Key concepts
12+
13+
This package revolves around setting up a server for facilitating peer-to-peer communication and message exchange in a distributed network. Key components include:
14+
15+
- **CoordinationServer**: A class for creating a coordination server instance, with methods for starting and stopping the server.
16+
- **createServer**: A helper function for instantiating the CoordinationServer class.
17+
- **ServerOptions**: The options type for customizing the coordination server's behavior.
18+
19+
## Usage
20+
21+
```typescript
22+
import { ServerOptions, createServer } from '@windingtree/sdk-server';
23+
import { memoryStorage } from '@windingtree/sdk-storage';
24+
25+
// Define your server options
26+
const options: ServerOptions = {
27+
port: 33333, // Server port
28+
peerKey: {...}, // Your peer key in JSON format
29+
messagesStorageInit: memoryStorage.createInitializer(), // Your messages storage initializer
30+
};
31+
32+
// Create a server
33+
const server = createServer(options);
34+
35+
// Start the server
36+
await server.start();
37+
38+
// Stop the server (e.g. in a shutdown handler)
39+
await server.stop();
40+
```
41+
42+
## Documentation
43+
44+
For full documentation and examples, visit [windingtree.github.io/sdk](https://windingtree.github.io/sdk)
45+
46+
## Testing
47+
48+
```bash
49+
pnpm test
50+
```
51+
52+
## Contributing
53+
54+
[Contribution guidelines](https://windingtree.github.io/sdk/#/docs/contribution)

0 commit comments

Comments
 (0)