First
Assumed you go registered at https://portal.skygeario.com
Second
git submodule to import the source code.
git submodule add https://github.com/SkygearIO/chat.git chat
In your cloud code, import the chat plugin. Skygear will load and lambda and database hook will be ready for use.
from .chat import plugin as chat_plugin
Third
Tell Skygear cloud to serve the asset from demo folder
from skygear import static_assets
from skygear.utils.assets import relative_assets
from .chat import *
@static_assets(prefix='demo')
def chat_demo():
return relative_assets('chat/js-sdk/demo')
https://<your_app_name>.skygeario.com/static/demo/index.html
Fourth
Update database schema
curl https://<your_app_name>.skygeario.com/chat-plugin-init
In this chat plugin, we have 2 model. It responsibility as follow.
- Conversation - storing information on who is the admins, conversation title, last message arrival time, etc.
- Message - actual message to be display on screen, including the related asset and metadata.
- UserConversation - the exist of this relation represent a user is participant of a conversation. It store information on user specific information to a conversation, like last read time and unread count.
For API detail, please visit the platform specific API filie:
- JS SDK
- [iOS SDK] - WIP
- [Android SDK] - WIP