@libp2p/pubsub 9.0.10 → 9.0.11-f71bc49bd
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 +35 -2
- package/dist/index.min.js +3 -3
- package/dist/src/index.d.ts +19 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +19 -4
- package/dist/src/index.js.map +1 -1
- package/package.json +13 -12
- package/src/index.ts +20 -4
- package/dist/typedoc-urls.json +0 -32
package/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# @libp2p/pubsub
|
2
|
+
|
1
3
|
[](http://libp2p.io/)
|
2
4
|
[](https://discuss.libp2p.io)
|
3
5
|
[](https://codecov.io/gh/libp2p/js-libp2p)
|
@@ -7,15 +9,46 @@
|
|
7
9
|
|
8
10
|
# About
|
9
11
|
|
12
|
+
<!--
|
13
|
+
|
14
|
+
!IMPORTANT!
|
15
|
+
|
16
|
+
Everything in this README between "# About" and "# Install" is automatically
|
17
|
+
generated and will be overwritten the next time the doc generator is run.
|
18
|
+
|
19
|
+
To make changes to this section, please update the @packageDocumentation section
|
20
|
+
of src/index.js or src/index.ts
|
21
|
+
|
22
|
+
To experiment with formatting, please run "npm run docs" from the root of this
|
23
|
+
repo and examine the changes made.
|
24
|
+
|
25
|
+
-->
|
26
|
+
|
10
27
|
A set of components to be extended in order to create a pubsub implementation.
|
11
28
|
|
12
29
|
## Example
|
13
30
|
|
14
|
-
```
|
31
|
+
```TypeScript
|
15
32
|
import { PubSubBaseProtocol } from '@libp2p/pubsub'
|
33
|
+
import type { PubSubRPC, PublishResult, PubSubRPCMessage, PeerId, Message } from '@libp2p/interface'
|
34
|
+
import type { Uint8ArrayList } from 'uint8arraylist'
|
16
35
|
|
17
36
|
class MyPubsubImplementation extends PubSubBaseProtocol {
|
18
|
-
|
37
|
+
decodeRpc (bytes: Uint8Array | Uint8ArrayList): PubSubRPC {
|
38
|
+
throw new Error('Not implemented')
|
39
|
+
}
|
40
|
+
|
41
|
+
encodeRpc (rpc: PubSubRPC): Uint8Array {
|
42
|
+
throw new Error('Not implemented')
|
43
|
+
}
|
44
|
+
|
45
|
+
encodeMessage (rpc: PubSubRPCMessage): Uint8Array {
|
46
|
+
throw new Error('Not implemented')
|
47
|
+
}
|
48
|
+
|
49
|
+
async publishMessage (sender: PeerId, message: Message): Promise<PublishResult> {
|
50
|
+
throw new Error('Not implemented')
|
51
|
+
}
|
19
52
|
}
|
20
53
|
```
|
21
54
|
|