Skip to content
 
 

Latest commit

 

History

76 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Protocollo di Comunicazione Chat-Java

Lista di chiamate possibili

Login

Client

  • Invio username e password
    { "type": "loginRequest", "username": "...", "password": "..." }

Server

  • Errore
    • Indica l'errore avvenuto durante login/registrazione
      { "type": "loginError", "message": "..." }
  • Successo
    • Invia lo user appena loggato
      { "type": "loggedUser", "id": "...", "username": "...", "profilePicture": "..." }
    • Invia le chat associate allo user appena loggato
      { "type": "chat", "id": "...", "name": "...", "photo": "...", "users": [...] }

      Nota: users può essere null o un array di oggetti [{"id":"...","username":"..."}, ...]

Registrazione

Client

  • Invio username, password e immagine profilo
    { "type": "registrationRequest", "username": "...", "password": "...", "profilePicture": "..." }

Server

  • Errore
    • Indica l'errore avvenuto durante login/registrazione
      { "type": "registerError", "message": "..." }
  • Successo
    • Invia lo user appena registrato
      { "type": "registerSucces", "message": "..." }

Homepage

INTERAZIONE CON CHAT (utente clicca su una chat)

  • Client
    • Invia id_Chat al server
      { "type": "messagesRequest", "chatId": "..." }
  • Server
    • Invia i messaggi associati alla chat
      { "type": "message", "chatId": "...", "text": "...", "created_at": "...", "username": "...", "userId": "..." }

UTENTE CREA NUOVA CHAT CON UN ALTRO UTENTE

  • Client
    • Invia l'username dell'utente con cui vuole creare la chat
      { "type": "chatRequest", "name": "..." }
  • Server
    • Errore (utente ricercato NON esiste o già presente nella lista delle chat)
      • Invia messaggio con errore
        { "type": "chatResponseError", "message": "..." }
    • Successo
      • Invia a tutti e due gli utenti (il 2° solo se connesso) la chat
        { "type": "chat", "id": "...", "name": "...", "photo": "..." }

UTENTE CREA NUOVO GRUPPO / VUOLE UNIRSI

  • Client
    • Invia nome del gruppo
      { "type": "groupRequest", "name": "..." }
  • Server
    • GRUPPO ESISTE
      • Modifica la chat e la reinvia a tutti gli utenti del gruppo (solo quelli connessi)
        { "type": "chat", "id": "...", "name": "...", "photo": "..." }
    • GRUPPO NON ESISTE
      • Crea un nuovo gruppo e lo invia al client
        { "type": "chat", "id": "...", "name": "...", "photo": "..." }

Dettaglio Chat

  • Client
    • Invia un messaggio
      { "type": "messageSent", "chatId": "...", "text": "...", "userId": "..." }
  • Server
    • Invia messaggio a tutti i partecipanti della chat
      { "type": "message", "chatId": "...", "text": "...", "created_at": "...", "username": "...", "userId": "..." }

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages