Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[arcade-chat] Basic chat channels+messages flow works #28

Merged
merged 31 commits into from
Aug 3, 2022

Conversation

AtlantisPleb
Copy link
Member

@AtlantisPleb AtlantisPleb commented Aug 3, 2022

Picture of in-channel message UI

Experimental Nostr chat support, adding message types 40 (channel create) and 42 (channel message). Envisioning that 41 will be channeljoin, and 43-4X will be various channel moderation events.

Most relevant logic is in:

This implementation is probably too simple, with channelId set in the content field. Should probably be a NIP-10 tag?

Open to feedback on how to restructure this to maximize interop with other event types if appropriate.

Relevant types currently:

export interface Channel extends NostrEvent {
  image: string
  name: string
  type: string // maybe 'public', 'private', 'geohash', 'geocoords'
}

export interface Message extends NostrEvent {
  channelId: string
  text: string // should maybe be 'content' but don't want to confuse with the event `content`
  type: string // text, image, etc...
}

Link to discussion in Nostr Telegram

@vercel
Copy link

vercel bot commented Aug 3, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
map-web ✅ Ready (Inspect) Visit Preview Sep 3, 2022 at 4:24AM (UTC)

@AtlantisPleb AtlantisPleb merged commit a124384 into main Aug 3, 2022
@AtlantisPleb AtlantisPleb deleted the arcade-chat branch August 3, 2022 04:25
@fiatjaf
Copy link

fiatjaf commented Aug 3, 2022

What do you think of

  • kind 40, channel create
  • kind 42, channel message, tags: ["e", <channel_create_event>]
  • kind 43, something else, tags: ["e", <channel_create_event>]

i.e. the channel id is the id of the channel creation event.

I don't see the need for a "channel join" event, but maybe that is useful only for cosmetic purposes.

kind 41 could be "channel metadata", similar to kind 0, but for setting a name, description etc for the channel.

@fiatjaf
Copy link

fiatjaf commented Aug 3, 2022

Another thing I was thinking is that it should be made clear that this is for public channels, since private channels would require a much more involving cryptographic protocol (that I personally am not sure it should even be done on Nostr).

@jb55
Copy link

jb55 commented Aug 3, 2022

I get channel create, but why can't channel messages be simple nip10 threads + kind1?

Seems like another missed opportunity for interoperability.

@fiatjaf
Copy link

fiatjaf commented Aug 3, 2022

@jb55 don't you think it is better that clients opt in to show these messages? It is easy for them to just specify kinds: [1, 42] instead of just kinds: [1], then they can add show them in the normal feed, but with added context since they know what 42 means -- while a client that doesn't won't show completely nonsensical kind-1 messages in the normal feed.

@jb55
Copy link

jb55 commented Aug 3, 2022

yes a different kind isn't the problem. as long as chatrooms follow nip10 then it should be trivial to make it interoperate in damus.

@AtlantisPleb
Copy link
Member Author

Cool - updated code here uses NIP10 tags for channel ID and event kind 41 for channel metadata.

Will firm up the API and release a test build in a few days, then will draft a NIP and ask feedback on that.

@jb55
Copy link

jb55 commented Aug 4, 2022

ah looks like 42 are json blobs so this isn't as simple as treating type 42 notes like type 1 notes :(

I guess these will just be separate from the rest of text nostrverse for now.

@jb55
Copy link

jb55 commented Aug 4, 2022

kind 42 suggestions:

nip10 support to me would mean:

channel_id is a root e tag
content is just the text

@fiatjaf
Copy link

fiatjaf commented Aug 4, 2022

Yes, please, just the text!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants