Skip to content

Commit 2cd94df

Browse files
committed
fix pubsub
1 parent 1b3741c commit 2cd94df

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/main/java/io/ipfs/api/IPFS.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ public Object peers(String topic) throws IOException {
234234
}
235235

236236
public Object pub(String topic, String data) throws IOException {
237-
return retrieveAndParse("pubsub/peers?arg="+topic + "&arg=" + data);
237+
return retrieveAndParse("pubsub/pub?arg="+topic + "&arg=" + data);
238238
}
239239

240240
public Supplier<Object> sub(String topic) throws IOException {

src/test/java/io/ipfs/api/APITest.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,11 @@ public void pubsub() throws IOException {
404404
String topic = "topic" + System.nanoTime();
405405
Supplier<Object> sub = ipfs.pubsub.sub(topic);
406406
Object first = sub.get();
407+
Assert.assertTrue(first.equals(Collections.emptyMap()));
407408
String data = "Hello!";
408409
Object pub = ipfs.pubsub.pub(topic, data);
409-
Assert.assertTrue(first.equals(Collections.emptyMap()));
410+
Object second = sub.get();
411+
Assert.assertTrue( ! second.equals(Collections.emptyMap()));
410412
}
411413

412414
private static String toEscapedHex(byte[] in) throws IOException {

0 commit comments

Comments
 (0)