@liveblocks/server 1.0.1
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/LICENSE +661 -0
- package/README.md +75 -0
- package/dist/index.cjs +3285 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1414 -0
- package/dist/index.d.ts +1414 -0
- package/dist/index.js +3285 -0
- package/dist/index.js.map +1 -0
- package/package.json +65 -0
package/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://liveblocks.io#gh-light-mode-only">
|
|
3
|
+
<img src="https://raw.githubusercontent.com/liveblocks/liveblocks/main/.github/assets/header-light.svg" alt="Liveblocks" />
|
|
4
|
+
</a>
|
|
5
|
+
<a href="https://liveblocks.io#gh-dark-mode-only">
|
|
6
|
+
<img src="https://raw.githubusercontent.com/liveblocks/liveblocks/main/.github/assets/header-dark.svg" alt="Liveblocks" />
|
|
7
|
+
</a>
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
# `@liveblocks/server`
|
|
11
|
+
|
|
12
|
+
<p>
|
|
13
|
+
<a href="https://npmjs.org/package/@liveblocks/server">
|
|
14
|
+
<img src="https://img.shields.io/npm/v/@liveblocks/server?style=flat&label=npm&color=c33" alt="NPM" />
|
|
15
|
+
</a>
|
|
16
|
+
<a href="https://bundlephobia.com/package/@liveblocks/server">
|
|
17
|
+
<img src="https://img.shields.io/bundlephobia/minzip/@liveblocks/server?style=flat&label=size&color=09f" alt="Size" />
|
|
18
|
+
</a>
|
|
19
|
+
<a href="https://github.com/liveblocks/liveblocks/blob/main/LICENSE">
|
|
20
|
+
<img src="https://img.shields.io/github/license/liveblocks/liveblocks?style=flat&label=license&color=f80" alt="License" />
|
|
21
|
+
</a>
|
|
22
|
+
</p>
|
|
23
|
+
|
|
24
|
+
`@liveblocks/server` provides the APIs to run a Liveblocks server yourself.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
bun install @liveblocks/server
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Architecture
|
|
33
|
+
|
|
34
|
+
```mermaid
|
|
35
|
+
classDiagram
|
|
36
|
+
Room --> Store : store
|
|
37
|
+
Room --> "0+" Session : sessions
|
|
38
|
+
Session --> WebSocket
|
|
39
|
+
|
|
40
|
+
class Room {
|
|
41
|
+
+roomId
|
|
42
|
+
+load()
|
|
43
|
+
+createTicket(version) Ticket
|
|
44
|
+
+startBrowserSession(Ticket ticket, WebSocket socket)
|
|
45
|
+
+handleRaw(Ticket ticket, data)
|
|
46
|
+
+endBrowserSession(Ticket ticket, code, reason)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
class Store {
|
|
50
|
+
+getString(key)
|
|
51
|
+
+getNumber(key)
|
|
52
|
+
+put(key, value)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
class Session{
|
|
56
|
+
+version
|
|
57
|
+
+actor
|
|
58
|
+
+nonce
|
|
59
|
+
+createdAt
|
|
60
|
+
+lastPong
|
|
61
|
+
+sendPong()
|
|
62
|
+
+sendServerMsg()
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
class WebSocket {
|
|
66
|
+
+...
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## License
|
|
71
|
+
|
|
72
|
+
Licensed under the GNU Affero General Public License v3.0 or later, Copyright ©
|
|
73
|
+
2021-present [Liveblocks](https://liveblocks.io).
|
|
74
|
+
|
|
75
|
+
See [LICENSE-AGPL-3.0](./LICENSE) for more information.
|