Skip to content
This repository has been archived by the owner on Aug 22, 2022. It is now read-only.

Fixing dep tree #8

Closed
wants to merge 2 commits into from
Closed

Fixing dep tree #8

wants to merge 2 commits into from

Conversation

daviddias
Copy link

@daviddias daviddias commented Aug 24, 2017

Started doing things for orbitdb-archive/orbit-web#9

It seems that is really embed in the concept of Orbit that PubSub messages are passed as strings and not as Buffers.

 1) Orbit send sends a message to a channel:
     TypeError: "string" must be a string, Buffer, or ArrayBuffer
      at Function.byteLength (buffer.js:477:11)
      at Promise (node_modules/ipfs-post/src/Post.js:44:51)
      at Promise (<anonymous>)
      at Function.create (node_modules/ipfs-post/src/Post.js:27:12)
      at Orbit._postMessage (src/Orbit.js:373:17)
      at getUser.then.then.then (src/Orbit.js:165:28)
      at <anonymous>

I fixed one of these assumptions, but now found that there is an assumption in another dependency. Before I follow this 🐇, I want to make sure it is cool to refactor this things, I might have to change a lot of nits to make it all work and end up with a big refactor.

@@ -152,7 +152,8 @@ class Orbit {
logger.debug(`Send message to #${channel}: ${message}`)

let data = {
content: message.substring(0, 2048),
// TODO: Question for Haad, why are you truncating messages?
content: new Buffer(message.substring(0, 2048)),
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@haadcode you were truncating every message. Is there a reason for that in Orbit?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, yeah! :D That was a quick fix long time ago when some random tester on orbit started flooding with very long messages. It's not a great place to fix that problem but rather should be fixed on the lower levels (orbit-db side). If you can, leave it as it is now (truncate the message, do use buffers if you're changing them) and we'll handle that in the data structures or in orbit-db eventually. Sound good?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. The message format should be a dag so that it can growth to any length (or at least block large messages at the user interaction level).

@haadcode
Copy link
Member

Hey @diasdavid and thank you for the PR! Awesome that you're willing to look into this <3 I won't have much bandwidth myself to work on it but I'll try to help you as much as possible.

Re. the string vs. Buffer assumption, iirc, I assumed strings way back in the day before we had pubsub. As far as I know there's no reason to continue on that assumption, but rather as you propose, use Buffers throughout the code. So if you're up for it, go ahead and change them.

@latenssi
Copy link
Contributor

Closing as this deviates from current master and is quite old

@latenssi latenssi closed this Sep 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants