Skip to content

Messages: As an end-user, I want to be able to send and receive messages from fellow students

  • The Messages sub-app shall be connected to other students chats via a web socket-server.
  • When the user opens the sub-app for the first time the user should be asked to write his/her username.
  • The username should remain the same the next time the user starts a messages sub-app or the PWD is restarted.
  • The user should be able to send chat messages using a textarea.
  • The user should be able to see at least the 20 latest messages since the chat applications was opened.

The server


The server address is:

wss://courselab.lnu.se/message-app/socket

You connect to the server via web sockets and send messages using the json-format:

{
  "type": "message",
  "data" : "The message text is sent using the data property",
  "username": "MyFancyUsername",
  "channel": "my, not so secret, channel",
  "key": "A api-key. Distributed through your 'Secrets'-project in the course group on gitlab"
}

The properties type, data, username and key are mandatory when sending a message to the server. The properties type, data and username will always be present when you receive a message from the server. Additionally, all properties sent from one user will be echoed to all receiving clients.

The API-key


Your API-key is distributed through your "Secrets"-project in the course group on gitlab.

Heartbeat


The web socket server will send a "heartbeat" message to keep the connection open. This message is sent every 40 seconds and have the following structure:

{
  "type": "heartbeat",
  "data" : "",
  "username": "Server"
}

Your application can simply ignore those messages completely.

Edited by Johan Leitet