About - MSUTashkent/RoomServer GitHub Wiki
The server is RESTful API web-application based on Yii Framework. Very simmilar to Whatsapp groups. But implemented on all platforms (Windows, MAC OS, iOS, Linux, BSD, Android). The data of the user is synchronized in all users' apps. You can send message from Desktop app and this message is posted on your Android/iOS Device and vice versa. The server sends private data and should run over HTTPS on production machines.
The server has Rooms. Users are added to the Room by the admin of the room. Each user can be in one o serveral rooms. Users can post messages to the room . And all other in the Room see this message.
All data to the server and from ther server is JSON formated.
The main APIs:
- Register/Auth API
- POST:/register + POST:{"login":"username","password":"plainpassword"}
- POST:/auth + POST:{"login":"username","password":"plainpassword"}
- GET:/logout
- Room CRUD API
- GET:/room/index //gets rooms currently available for this user
- POST:/room/create //create new room
- POST:/room/delete //delete the room (only admin of the room can do that)
- POST:/room/update //update room infos
- POST:/room/joinUser //admin of the room adds the user to the room
- GET:/room/unjoinUser //admin whants to delete user
- GET:/room/getOut //user wants to get out of the room
- Messaging API
- POST:/postMessage
- GET:/messages //get new messages for selected room
Below is the API specifications.
User wants to register to RoomServer.
Use sends the registration infos
server resonds:
{ "code":0, //success "data": { "user_id" : 12095, //OPTIONAL!!! "session-token" : "abasdfab2342sfasdf2345s!@$11230@+_9asdfm324", "expiration-date" : "2013-11-02 11:33:55", //NOTE: this is the time on server! } }
if there was an error it returns error code in "code" and its description in "data" object with structure:
{ "text" : "Selected password is too weak", }
and the whole response in case of error is:
{ "code":-5, //PASSWORD_TOO_WEAK "data": { "text" : "Selected password is too weak", } }
User wants to pass authentication and get session-token.
data send is equivalent to previous
User wants to logout out of the system.
User sends its session-token and gets logged out of system
Room admin (any user who creates the room) wants to CRUD=).
User sends its session-token and some infos (needs to be specified later) and the server respods with
{ "code":0, "data": { "rooms" : [ //... ], } }
in case of success. Else the error is returned.
User wants to post a message to the room.
User sends his session-token + message infos (needs to be specified later)
User wants to get new messages for selected room. User sends
{ "session-token" : "abasdfab2342sfasdf2345s!@$11230@+_9asdfm324", "room_id":12, "lastUpdate":"2013-11-02 11:33:55" }
and the server responds with:
{ "code":0, "data": { "messages" : [ //... ], } }
in case of success. Else the error is returned.