Skip to content

meshboy/socket-chat-dynamodb

Repository files navigation

Test Base URL : localhost:80

Authentication: Basic Auth

username: xxxx Password: xxx

Upload File

POST /file/upload

Request

formData {
  media: fileObject
}

Response

{
    "status": true,
    "data": {
        "id": "604cf103886256679bf2cb97"
    }
}

Fetch File by id

GET /file/:id

Response

fileObject;

Add new account to server

please note: a user that wants to use this system needs to be added to the db as only the id would be stored

POST /user

Request

{
    "id": "08164663352"
}

Response

  "status": true,
    "data": {
        "id": "08164663352",
        "timeCreated": 1616063749959,
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjA4MTY0NjYzMzUyIiwicm9sZSI6InVzZXIiLCJpYXQiOjE2MTYwOTEyNjl9.S2srOnvBiPRJjI5ojEdYJj9rA5lSKoaxfCczYbTaxwc"
    }

Validate if id is on server

POST /user/validate

Request

[
  {
    id: "08164663352",
  },
  {
    id: "08164663357",
  },
];

Response

{
    "status": true,
    "data": [
        {
            "id": "08164663352",
            "isAvailable": true
        },
        {
            "id": "08164663357",
            "isAvailable": false
        }
    ]
}

Chat Path

send chat

Event Name

chatMessage

Event PayLoad

{
  token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImZha2VVc2VySWQiLCJyb2xlIjoidXNlciIsImlhdCI6MTYxNjI2NjkyMH0.f2vzMfOLNAwH4I8AUSQ-TrU-1ykmvyhfOv2SWhTfZdc',
  message: 'hello bobo',
  senderUsername: 'sender john',
  recipientUsername: 'receiver mike',
  messageType: 'TEXT',
  recipientId: 'fakeRecipient',
  timeCreated: 1616266920605
}

Receive chat

Event Name

senderId:recipientId

Event PayLoad

{
  message: 'hello  bobo',
  senderUsername: 'sender john',
  recipientUsername: 'receiver mike',
  messageType: 'TEXT',
  recipientId: 'fakeRecipient',
  timeCreated: 1616267123089
}

messageType: TEXT, FILE

Error Listener

Event Name

errorMessage

unauthorised error

{"status":false,"message":"UN_AUTHORISED"}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published