For for socket we are using nodejs.

Base Url https://live-location-tracking-backend.onrender.com/

Events

JOIN_ROOM

socket.emit("JOIN_ROOM", userId) //User will join unique room

SEND_MESSAGE

socket.emit("SEND_MESSAGE", messageData)

When you will call post api of create message in response you will get bellow res
Except members you will get chatById api and you to append and sen

messageData =  {
"id": "63c40041-8736-456b-af53-c56729aacd00",
    "sender": {
        "id": "8",
        "firstName": "Jhon",
        "lastName": "Kumar",
        "phone": "2222",
        "email": "[email protected]",
        "password": "ykdfsh@raj",
        "avatarUrl": "<https://icon-library.com/images/anonymous-avatar-icon/anonymous-avatar-icon-25.jpg>",
        "createdAt": "2023-05-16T21:54:25.123898"
    },
    "members": [
        {
            "id": "1",
            "firstName": "Amarendra",
            "lastName": "Kumar",
            "phone": "7479464719",
            "email": "[email protected]",
            "password": "ykdfsh@raj",
            "avatarUrl": "<https://icon-library.com/images/anonymous-avatar-icon/anonymous-avatar-icon-25.jpg>",
            "createdAt": "2023-05-14T17:34:43.906335"
        },
        {
            "id": "2",
            "firstName": "Jhon",
            "lastName": "Kumar",
            "phone": "2222",
            "email": "[email protected]",
            "password": "ykdfsh@raj",
            "avatarUrl": "<https://icon-library.com/images/anonymous-avatar-icon/anonymous-avatar-icon-25.jpg>",
            "createdAt": "2023-05-16T21:54:25.123898"
        },
        {
            "id": "3",
            "firstName": "Jhon",
            "lastName": "Kumar",
            "phone": "2222",
            "email": "[email protected]",
            "password": "ykdfsh@raj",
            "avatarUrl": "<https://icon-library.com/images/anonymous-avatar-icon/anonymous-avatar-icon-25.jpg>",
            "createdAt": "2023-05-16T21:54:25.123898"
        }
    ],
    "senderId": "13b82817-2dd5-4053-8e33-1e1361eed050",
    "chatId": "bb5822a1-34c7-4ca7-8309-4f2a3a7ef140",
    "message": "How are buddy",
    "createdAt": "2023-05-16T21:57:19.017199"
}

RECEIVED_MESSAGE

You have listen when some one send message you will get here

socket.on("RECEIVED_MESSAGE", (receivedMessage){
	
})

receivedMessage: same response body of SEND_MESSAGE