1.1.6 • Published 1 year ago

@leofcoin/peernet-swarm v1.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

peernet-swarm

peernet peer discoverer & connector

usage

server

import {Server} from '@leofcoin/peernet-swarm'

const network = 'leofcoin:peach'
const port = 44444

new Server(port, network)

client

import {Client} from '@leofcoin/peernet-swarm'

const stars = ['wss://peach.leofcoin.org']
const networkVersion = 'peach'
// wrtc object is added into glabalSpace
new Client(id, networkVersion, stars)

browser

import {Client} from '@leofcoin/peernet-swarm/dist/client.browser.js'

// wrtc object is added into glabalSpace
new Client(id, networkVersion, stars)

examples

events

const client = new Client(id, networkVersion, stars)
// events exposed to pubsub
pubsub.subscribe('peer:data' data => console.log(data))
pubsub.subscribe('peer:joined', peer => console.log(peer))
pubsub.subscribe('peer:left', peer => console.log(peer))
pubsub.subscribe('peer:connected', peer => console.log(peer))
peernet.subscribe('peernet-shard', async message => console.log(message) // {id, data, size}
// const finished = await _handleMessage()

properties

const client = new Client(id, network)
client.id
client.connection
client.connections // object {id: connection}
0.5.10

1 year ago

0.5.11

1 year ago

1.0.0

1 year ago

0.5.18

1 year ago

0.5.19

1 year ago

0.5.16

1 year ago

0.5.17

1 year ago

0.5.14

1 year ago

0.5.15

1 year ago

0.5.12

1 year ago

0.5.13

1 year ago

0.5.6

1 year ago

1.1.0

1 year ago

0.5.8

1 year ago

0.5.7

1 year ago

0.5.9

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

0.5.21

1 year ago

0.5.22

1 year ago

0.5.20

1 year ago

0.5.23

1 year ago

0.5.4

1 year ago

0.5.3

1 year ago

0.5.5

1 year ago

0.5.0

1 year ago

0.5.2

1 year ago

0.5.1

1 year ago

0.3.9

2 years ago

0.3.12

2 years ago

0.3.11

2 years ago

0.3.10

2 years ago

0.4.4

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago

0.4.3

1 year ago

0.4.2

1 year ago

0.3.6

2 years ago

0.3.8

2 years ago

0.3.7

2 years ago

0.3.5

2 years ago

0.3.4

2 years ago

0.1.20

2 years ago

0.1.21

2 years ago

0.3.0

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.17

2 years ago

0.1.18

2 years ago

0.1.19

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.3

2 years ago

0.1.16

2 years ago

0.1.15

2 years ago

0.1.14

2 years ago

0.1.13

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago