mirror of https://github.com/waku-org/js-waku.git
Must pass filter.all to connect to ip4 ws peer
This commit is contained in:
parent
3285d498c7
commit
09fa8a0447
|
@ -3,12 +3,15 @@ import Mplex from 'libp2p-mplex';
|
|||
import { bytes } from 'libp2p-noise/dist/src/@types/basic';
|
||||
import { Noise } from 'libp2p-noise/dist/src/noise';
|
||||
import Websockets from 'libp2p-websockets';
|
||||
import filters from 'libp2p-websockets/src/filters';
|
||||
import { Multiaddr } from 'multiaddr';
|
||||
import PeerId from 'peer-id';
|
||||
|
||||
import { RelayCodec, WakuRelay } from './waku_relay';
|
||||
import { StoreCodec, WakuStore } from './waku_store';
|
||||
|
||||
const transportKey = Websockets.prototype[Symbol.toStringTag];
|
||||
|
||||
export interface CreateOptions {
|
||||
listenAddresses: string[];
|
||||
staticNoiseKey: bytes | undefined;
|
||||
|
@ -70,6 +73,13 @@ export default class Waku {
|
|||
// @ts-ignore: Type needs update
|
||||
pubsub: WakuRelay,
|
||||
},
|
||||
config: {
|
||||
transport: {
|
||||
[transportKey]: {
|
||||
filter: filters.all,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const wakuStore = new WakuStore(libp2p);
|
||||
|
|
|
@ -14,3 +14,4 @@ declare module 'libp2p-secio' {
|
|||
export = Secio;
|
||||
}
|
||||
declare module 'libp2p-websockets';
|
||||
declare module 'libp2p-websockets/src/filters';
|
||||
|
|
|
@ -12,9 +12,6 @@ import { WakuContext } from './WakuContext';
|
|||
|
||||
export const ChatContentTopic = 'dingpu';
|
||||
|
||||
interface Props {
|
||||
}
|
||||
|
||||
interface State {
|
||||
messages: string[],
|
||||
waku?: Waku
|
||||
|
@ -44,12 +41,9 @@ export default function App () {
|
|||
}
|
||||
});
|
||||
|
||||
try {
|
||||
await waku.dial('/ip4/127.0.0.1/tcp/7777/ws/p2p/QmUJKveCpfwA4cY1zRybMEt5z64FRtMHLFFQwndWrSfMmf');
|
||||
console.log('Remote node dialed');
|
||||
} catch (e) {
|
||||
console.log('Error when dialing peer ', e);
|
||||
}
|
||||
waku.libp2p.peerStore.addressBook.add(
|
||||
PeerId.createFromB58String('QmbEnEniueE2Cetej6UkYAtvHuXuare4fSEeyvm43kdmfq'),
|
||||
[multiaddr('/ip4/127.0.0.1/tcp/7777/ws')]);
|
||||
} catch (e) {
|
||||
console.log('Issue starting waku ', e);
|
||||
}
|
||||
|
@ -61,7 +55,7 @@ export default function App () {
|
|||
.then(() => console.log('Waku init done'))
|
||||
.catch((e) => console.log('Waku init failed ', e));
|
||||
}
|
||||
}, [state.waku]);
|
||||
});
|
||||
|
||||
|
||||
return (
|
||||
|
|
Loading…
Reference in New Issue