Anatomy of OpenSeed Chat

in OpenSeed4 years ago (edited)


To make this more enjoyable read it in the voice of the narrator in a Goofy cartoon.


Ahh Chat, what would the world be like with out idle conversations and almost constant connection with the ones we love? And what better way to chat than to use a Mobile phone or Computer! Well friends you're in luck, because with OpenSeed you too can add chat to your mobile application or website!

So let us begin to explain how to add OpenSeed chat to your next project.

Open Seed chat is meant to be a general use chat implementation that can be incorporated into any OpenSeed connected application. It will support all the standard chat features as well as those that are tightly integrated with OpenSeed including NFTs and other digital assets.


OpenSeed uses a simple REST mechanic to maximize cross platform usability where in all command sent to the server regardless to the interface looks like this:

<url>/?devPub=<Developers public id>&msg=<encrypted message>

If you read my last post you will understand what constitutes that encrypted message so we wont be going over the specifics here. However the rest of the document will refer to the non encrypted commands that use json notation shown below:

{"act":"get_chat","room":"<room-id>","uid":"<user-id>","last":"<last message index>"}

Defining a Chat Session

To make things simple OpenSeed defines any encrypted message storage as a chat session or chat room if you rather. In this way OpenSeed can support chat rooms ranging from a single user chat (good for note taking) to large chat communities like we see in discord. For those that need a little more definition

  • Note: Single user chat
  • DM: Chat between two people
  • Group: Chat between more than two people but limited to a set list.
  • Open Chat: Sessions based on room id instead of the list of users. [Unencrypted!] (Good for live comments on videos, or a comment replacement)

Starting a Chat

Starting a chat in OpenSeed is simple and straight forward when it comes to notes and DMs however special considerations will need to be made to create Group chats or to setup Open Chats. Below is the standard work flow for the fist two while the last two will be discussed afterwards.

  • Notes and DMs: To start a single user or two user chat the developer simple calls chat_history to either create or list the contents of a chat session. This ensures that the room, attendees, and title are setup correctly regardless to the application.

{"act":"chat_history","room":"<room-id>","uid":"<user-id>","count":"40","last":"<last message index>"}

Note the count variable. This is used to dictate how many messages in the past you want returned. Last is usually 0 but you can specify a starting position if you so choose

  • Group Chats: Group chats require the developer to call create_chat to supply a list of attendees, as well as a title. The room id will be generated by OpenSeed

{"act":"create_chat","title":"<title>","attendees":"<user list>,"uid":"<user-id>"}

Once the above returns your room-id run the chat_history action to verify.

{"act":"chat_history","room":"<room-id>","uid":"<user-id>","count":"40","last":"<last message index>"}

  • Open Chats: These chat rooms are created using an id that references a location and have no attendees listed, nor title. Creation of these chats is facilitated by create_open_chat and due to the nature of the room it will not be encrypted.


Now you can use the same get_history command to list the content of this chat room.

{"act":"chat_history","room":"<location>","uid":"open","count":"40","last":"<last message index>"}

Note that we change the uid to "open" this informs the server that there is no attendees list so no check is necessary. However, the server will verify that the chat is truly open before returning data.

Listing and Updating chat.

As stated above the chat_history action will quickly get any chat window up-to-date and provides the index of each message. Once the history has been received you will use the get_chat function to update the chat log with new messages. Below would be the standard method to get and update the chat

{"act":"chat_history","room":"<room-id>","uid":"<user-id>","count":"40","last":"<last message index>"}

Once the history is parsed you would run

{"act":"get_chat","room":"<room-id>","uid":"<user-id>","last":"<last message index>"}

to receive the newest messages.

This method will work with all chat types changing the needed room and uid variables as needed.

Sending Chat messages.

Communication is a two way street, as such being able to send a message to the other members of the chat is key to convey your desired will. (again use your best Goofy cartoon narrator voice)

OpenSeed makes this easy with one command, and the appropriate variables you can send a message to any chatroom you are allowed to participate in. The simplest example is listed below.

{"act":"send_chat","room":"<room-id>","uid":"<user-id>","message":"<the message>"}

You will receive a return from the server after the message has been received. If the return is in the affirmative you can run get_chat to update your chat window with the new message.

{"act":"get_chat","room":"<room-id>","uid":"<user-id>","last":"<last message index>"}

As you can see the chat functions are straight forward and simple, though the increased security we employ in OpenSeed does create some implementation hurdles once setup everything "just works." In future posts we'll go over what it takes to create the encrypted messages and how you can use them in your next project. If you would like to join the discussion or get involved check out our discord server here.

** The origami dragon is one of my own designs and the image is also taken by me. **


Hi @bflanagin!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your UA account score is currently 5.064 which ranks you at #672 across all Steem accounts.
Your rank has not changed in the last three days.

In our last Algorithmic Curation Round, consisting of 69 contributions, your post is ranked at #17.

Evaluation of your UA score:
  • You've built up a nice network.
  • The readers like your work!
  • Try to work on user engagement: the more people that interact with you via the comments, the higher your UA score!

Feel free to join our @steem-ua Discord server

Congratulations @bflanagin! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You distributed more than 78000 upvotes. Your next target is to reach 79000 upvotes.

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

Downvote challenge - Add up to 3 funny badges to your board
Use your witness votes and get the Community Badge
Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.26
TRX 0.10
JST 0.033
BTC 43410.74
ETH 2361.82
USDT 1.00
SBD 5.28