A chat app
Find a file
2026-05-02 16:17:20 +01:00
_data Dont push database to git accidentally again... 2026-04-17 16:45:47 +01:00
cmd/server Chat users, sending notifications only to participants 2026-04-29 21:52:34 +01:00
internal Friends 2026-05-02 16:17:20 +01:00
.gitignore notes 2026-04-14 23:04:39 +01:00
go.mod Switch to SSE rather than websockets 2026-04-28 23:45:31 +01:00
go.sum Switch to SSE rather than websockets 2026-04-28 23:45:31 +01:00
README.md event handler idea 2026-04-18 00:54:08 +01:00

Notes for planning Yapper

Features

  • 1 on 1 conversations
  • Group chats
  • Calls
  • Screen share
  • Meetings/Call plannings

Endpoints

There should be 2 entry points, HTTP REST-like API, and the Websocket endpoint(s)

Websocket

Websockets will probably be a read-only stream of data? https://devcenter.heroku.com/articles/websocket-security

they live under the /ws/vX/... path

/ws/v1/authenticate -> token wss://{username}:{token}@/ws/v1/connect

Tokens can only be used once per connection, should only be used by the requesting session + ip

REST

Any interactions done by the user, eg sending messages, should be done through the REST API.

They live under the /api/vX/... path

/api/v1/message/create /api/v1/about/me

Events

The app should have an event loop that any handler can broadcast an event to any other part of the app

handler.SendEvent(UserMessage{
    Content: "blah blah",
    Author: user,
})

handler.SendEvent(UserOnline{
    User: user,
})

handler.SendEvent(ChatCreated{
    Group: group,
    Kind: "directMessage", // directMessage, groupChat
})

for event <- handler.EventQueue {
    switch e := event.type {
    case UserMessage:
        // blahblah

    case ChatCreated:
        // blahblah
    }
}