This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Pubsub message fields #1077
Merged
Merged
Pubsub message fields #1077
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3602dbd
fix(pubsub): topicCIDs should be topicIDs
richardschneider 1f68a16
fix(pubsub): msg.from field is base64 encoding of peer id
richardschneider bca9ff2
fix: oops
richardschneider f107763
chore: update deps
daviddias 5b7dfdd
Merge branch 'master' into pubsub-message
daviddias 404d9e1
write interop test setup for richard
daviddias 202bc1d
fix: allow go daemon flags to be specified
richardschneider 3ed8cb2
test: pubsub interop with go (WIP)
richardschneider 5eefd30
chore: fix linting
daviddias f2c8296
fix more linting
daviddias 007b4ce
fix interop tests
daviddias File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -317,4 +317,3 @@ function toTypeCode (type) { | |
return 0 | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ require('./repo') | |
require('./exchange-files') | ||
require('./circuit-relay') | ||
require('./kad-dht') | ||
require('./pubsub') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* eslint-env mocha */ | ||
'use strict' | ||
|
||
const chai = require('chai') | ||
const dirtyChai = require('dirty-chai') | ||
const expect = chai.expect | ||
chai.use(dirtyChai) | ||
const series = require('async/series') | ||
const parallel = require('async/parallel') | ||
|
||
const GODaemon = require('../utils/interop-daemon-spawner/go') | ||
const JSDaemon = require('../utils/interop-daemon-spawner/js') | ||
|
||
describe('pubsub', () => { | ||
let jsD | ||
let goD | ||
let jsId | ||
let goId | ||
|
||
before(function (done) { | ||
this.timeout(50 * 1000) | ||
|
||
goD = new GODaemon({ | ||
disposable: true, | ||
init: true, | ||
flags: ['--enable-pubsub-experiment'] | ||
}) | ||
jsD = new JSDaemon() | ||
|
||
parallel([ | ||
(cb) => goD.start(cb), | ||
(cb) => jsD.start(cb) | ||
], (done)) | ||
}) | ||
|
||
after((done) => { | ||
series([ | ||
(cb) => goD.stop(cb), | ||
(cb) => jsD.stop(cb) | ||
], done) | ||
}) | ||
|
||
it('make connections', (done) => { | ||
parallel([ | ||
(cb) => jsD.api.id(cb), | ||
(cb) => goD.api.id(cb) | ||
], (err, ids) => { | ||
expect(err).to.not.exist() | ||
|
||
jsId = ids[0].ID | ||
goId = ids[0].ID | ||
|
||
console.log('jsId:', jsId) | ||
console.log('goId:', goId) | ||
|
||
parallel([ | ||
(cb) => jsD.api.swarm.connect(ids[1].addresses[0], cb), | ||
(cb) => goD.api.swarm.connect(ids[0].addresses[0], cb) | ||
], done) | ||
}) | ||
}) | ||
|
||
it.skip('publish from JS, subscribe on Go', (done) => { | ||
// TODO write this test | ||
}) | ||
|
||
it.skip('publish from Go, subscribe on JS', (done) => { | ||
const topic = 'pubsub-go-js' | ||
const data = Buffer.from('hello world') | ||
|
||
function checkMessage () { | ||
console.log('check message', arguments) | ||
} | ||
|
||
series([ | ||
cb => jsD.api.pubsub.subscribe(topic, checkMessage, cb), | ||
cb => goD.api.pubsub.publish(topic, data, cb) | ||
], done) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@richardschneider this was causing all interop tests to fail.