Skip to content

Latest commit

 

History

History
59 lines (38 loc) · 1.33 KB

File metadata and controls

59 lines (38 loc) · 1.33 KB

The Chat application

This a a short description on the chat application that uses the WebSockets API.

[[TOC]]

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. Found when logged in on the course webpage"
}

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.

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 completly.

The API-key

Use the following API key.

eDBE76deU7L0H9mEBgxUKVR0VCnq0XBd