You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 21, 2023. It is now read-only.
import{createLibp2pNode}from'libp2p'import{webSockets}from'@libp2p/webrtc-direct'constnode=awaitcreateLibp2p({transports: [webSockets()]//... other config})awaitnode.start()awaitnode.dial('/ip4/127.0.0.1/tcp/9090/ws')
You can create your own address filters for this transports, or rely in the filters provided.
The available filters are:
filters.all
Returns all TCP and DNS based addresses, both with ws or wss.
filters.dnsWss
Returns all DNS based addresses with wss.
filters.dnsWsOrWss
Returns all DNS based addresses, both with ws or wss.
Libp2p Usage Example
import{createLibp2pNode}from'libp2p'import{websockets}from'@libp2p/websockets'importfiltersfrom'@libp2p/websockets/filters'import{mplex}from'@libp2p/mplex'import{noise}from'@libp2p/noise'consttransportKey=Websockets.prototype[Symbol.toStringTag]constnode=awaitLibp2p.create({transport: [websockets({// connect to all sockets, even insecure onesfilters: filters.all})],streamMuxers: [mplex()],connectionEncryption: [noise()]})
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
About
WebSockets module that libp2p uses and that implements the interface-transport spec