nMobile message protocol

Message Content Type

text

field value type description
id string random uuid
contentType text string
topic string Topic name,the private chat is null
content object JSON format
timestamp long digital representation of time in milliseconds. for conversion to specific time in time zones around the world.
options json string

receipt

field value type description
id string random uuid
contentType receipt string
targetID string target msg id
timestamp long digital representation of time in milliseconds. for conversion to specific time in time zones around the world.

textExtension

  • Burn after reading
  • Theme color (not implemented yet)

This is separated from text content type so web d-chat can simply ignore this content type if not implemented.

field value type description
id string random uuid
contentType textExtension string
topic string Topic name,the private chat is null
content object JSON format
timestamp long digital representation of time in milliseconds. for conversion to specific time in time zones around the world.
options object

Contact Protocol

field value type description
id string random uuid
contentType contact string
requestType header/full string response should not contain this field
content {name: “”, avatar: { type: “base64”, data: “”}} object should not contain this field if request type is header
version string random uuid
expiresAt long

If requestType is header, other side should respond with only version and expiresAt to indicate meta data.

If requestType is full, other side should include content as well.

Contact Options Protocol

field value type description
id string random uuid
contentType event:contactOptions string
content {“deleteAfterSeconds”:10} object
timestamp long digital representation of time in milliseconds. for conversion to specific time in time zones around the world.

Currently only used for dialog burn after read settings, similar to Signal.

private channel

field value type description
id string random uuid
contentType event:channelInvitation string
content topic name string
timestamp long digital representation of time in milliseconds. for conversion to specific time in time zones around the world.

Event

Subscribe

field value type description
id string random uuid
contentType event:subscribe string
topic string

Unsubscribe

field value type description
id string random uuid
contentType event:unsubscribe string
topic string

Add Permission

See [NKP-0016] Client side pub/sub permission control for details about permission spec.

field value type description
id string random uuid
contentType event:add-permission string
topic string
content {addr: “nkn-client-addr”} or {pubkey: “public-key”} object

Remove Permission

See [NKP-0016] Client side pub/sub permission control for details about permission spec.

field value type description
id string random uuid
contentType event:remove-permission string
topic string
content {addr: “nkn-client-addr”} or {pubkey: “public-key”} object
1 Like

Shouldn’t this be internal? Why would I want a user profile to expire? What value are you using here, how long?

that should obv be

field value type description
topic string Topic name,the private chat is null

Not too keen on “firstName, lastName”. Isn’t it fine if it’s just “name”?

Shouldn’t this be internal? Why would I want a user profile to expire? What value are you using here, how long?

It’s like the profile cache expiration time, same as cache-control header in http response. It just tells requester how long they can cache it before requesting again. And requester does not have to follow it, just like browser can ignore cache-control header and fetch new content.

that should obv be

field value type description
topic string Topic name,the private chat is null

Oh you are right, but it should be in text type but not receipt type right?

Not too keen on “firstName, lastName”. Isn’t it fine if it’s just “name”?

Agreed. Actually we also want to change it but have not yet.

Receipts are only used in whispers, but you could use them in topics. Wouldn’t do that, though, so yeah, you’re right.

What default value are you using? Gonna be using 1 week.

Makes more sense to me to have this as internal, but I guess it’s whatever, I’ll overwrite it.

I thought about asking once per session per person, but then you could end up getting 300 header requests when you send a message.

Here’s my, somewhat dated, notes about the schemas: https://gitlab.com/losnappas/d-chat/-/tree/master/src/workers/nkn

What default value are you using? Gonna be using 1 week.

Let me ping @heron for accurate info.

I thought about asking once per session per person, but then you could end up getting 300 header requests when you send a message.

Yeah IMO that’s probably too much for just getting the profile (username + avatar) :joy:

What default value are you using? Gonna be using 1 week.

@lynn Turns out that nMobile Flutter is using 0 currently and has not implemented the cache at all :joy: Android native version is using 30m.

Maybe I will leave it as undefined to mark that I’m not going to respect it anyhow. I assume all the profile data fields can be marked as optional. Initially, I’m only going to use the avatar field in d-chat.

Changed firstname/lastname to a single name field

Instead of expires_at, let’s keep going with the style and use expiresAt?

D-Chat doesn’t send either, though, and overwrites anything with 1week.

It also includes timestamp and stuff, but those can be ignored, of course.

Good. D-chat doesn’t send a name yet (no UI to input one), just avatar.

Instead of expires_at , let’s keep going with the style and use expiresAt ?

Oh you are right, I believe it’s just a typo. Will update the doc to expiresAt.