Using sockjs & nsq & flask & mysql, implement a im demo.
Fetch threads list
- offset {int}: Page number
- limit {int}: Page size
Response
{
"paging": {
"prev": //,
"next": //,
"has_next": //
},
"data": [
{
"id": // Thread id, type is string,
"message": {
"sender": // Sender info,
"receiver": // Receiver info,
"content": // Message content, type is string
},
"is_read": // Has read or not, type is int
}
]
}
Get detail message in a thread.
Response:
{
"paging": {
"prev": //
"next": //
"has_next": //
},
"data": [
{
"id": // Message id, type is int,
"sender": // Sender info,
"receiver": // Receiver info,
"content": // Message content, type is string
}
]
}
Set thread status to read.
{
"success": True/False
}
Response
- zc.buildout
pip install zc.buildout
After you install zc.buildout
, clone the source code, change directory to it,
execute command below:
buildout
You can view install instruction here.
After everythings is ok, you can run
- start im service
bin/im
- start im api service
bin/im_apis
##### You can debug flask service, via environment setting by
DEBUG=flask bin/im_apis