WebSocket

Call Login API and get the access token (HTTP Request)

curl --request PUT \
 --url https://app.qordoba.com/api/login \
 --header 'content-type: application/json' \
 --data '{"username":"jim@qordoba.com","password":"*****"}'

Response

{
 "result": "success",
 "token": "44e90b43-90e3-4ba7-8a89-877730",
 "remember_me": null,
 "loggedUser": {
      "id": 1012,
      "first_name": "Jimmy",
      "last_name": "Ali",
      "email": "Jim@qordoba.com",
      "name": "Jimmy",
      "avatar": "",
      "organizations": [
         {
             "id": 3002,
             "name": "Fetchr",
             "role": "owner"
             ...........
         }
      ],
      "timezone": "Asia/Dubai",
      "created_at": 1420070400000,
      "phone_number": null,
      "last_online": 1490643673000
   }
}

Using the access token to connect websocket ( FE will store the access token for future usage ie. reconnect)
Get User Organizations → check the login api response.
Get organization projects (only strings projects) (HTTP Request)

curl --request GET \
 --url 'https://app.qordoba.com/api/organizations/3002/projects?limit=50&offset=0' \
 --header 'x-auth-token: e3f87538-25d1-432d-907e-bc3f8'
Get project target language (HTTP Request) -→ check projects response

User will retrieve all the project segments and he can filter by the file id
Save on every char change or on Enter/tap
For every change in the file/project segments websocket should send message to the FE
Connect to websocket:
wss://app.qordoba.com/ws/websocket?token={access_token}

Subscribe to segments update channel:

{
      "identifier": "/projects/:project_id/languages/:language_id/segments_live_updates",
       "message_id": "4kzx09c7qyscf56jkixtq8semi",
       "message_type": "subscribe",
       "params": {
             "project_id": 1906,
             "language_id": 28
        }
}

Once app is subscribed to the channel, it'll start getting push messages when segments get updated:

{
    "identifier":"/projects/:project_id/languages/:language_id/segment_updated",
    "message_id":"l572gr7jbtep14i",
    "message_type":"push_notification",
    "params":{
        "project_id":1906,
      "language_id": 28       
    },
    "content":{
         "segment":{
                 "segment_id": 94509027,
                 "translation_id": 114651520,
                 
                 "translation": "يقبل متجر \"ليڤيل شوز\" التسديد بواسطة كلٍّ من بطاقات فيزا وماستر كارد وأمريكان إكسبريس وكذلك الدفع النقدي عند التسليم كوسائل دفع لعمليات الشراء التي تجري عبر الإنترنت.",
                 "updated_user_id": 1112
    }
} 

When App Save segment:

{
   "identifier":"/projects/:project_id/languages/:language_id/save_segment",
   "message_id":"l572gr7jbtep14i",
   "message_type":"request",
   "params":{
       "project_id":1906,
      "language_id": 28       
   },
   "content":{
         "segment":{
                 "segment_id": 94509027,
                 "translation_id": 114651520,
                 "translation": "يقبل متجر \"ليڤيل شوز\" التسديد بواسطة كلٍّ من بطاقات."
    }
}

When App edit one char

{
   "identifier":"/projects/:project_id/languages/:language_id/live_edit_segment",
   "message_id":"l572gr7jbtep14i",
   "message_type":"request",
   "params":{
       "project_id":"1906",
      "language_id": "28"       
   },
   "content":{
         "segment_id": "94509027",
         "translation_id": "114651520",
         "translated": "يقبل متجر \"ليڤيل شوز\" التسديد بواسطة كلٍّ من بطاقات."
    }
}