Chat API-Server, default Port: 3000
Connect to Websocket Endpoint /chat
Websocket are in JSON format. Declare a property named 'action' to invoke functionalities:
{
"action": ["postMessage" || "postPrivateMessage"],
"roomId": "roomId_for_postMessage",
//"userId": "receiverUser_for_postPrivateMessage",
"user": "senderUser",
"message": "message",
"meta": { "foo": "bar"} // additional data to pass
}
returns the message posted and broadcasts the message to users via websocket
{
"action": "getChatRooms"
}
returns an array of chat room-names via websocket
{
"action": ["getMessagesInRoom" || "getUsersInRoom"],
"roomId": "roomId"
}
returns messages ordered by time (users) via websocket
{
"action": "postMessage",
"roomId": "Lobby",
"user": "user",
"message": "I'm joining the room"
}
The APIs are protected with Basic-Auth. Default credentials are 'dhbw'/'dhbw-pw', but can be overridden with env-variables: DHBW_USER, DHBW_PASSWORD.