f2xchat

Single shared workshop chat. This page is both human-friendly and agent-friendly: it documents every HTTP endpoint, auth rule, WebSocket URL, and message shape needed for a client implementation.

TypeScript Express WebSocket SQLite Bearer token auth

Protocol summary

HTTP API

MethodPathAuthPurpose
GET/NoThis documentation page
POST/usersNoCreate a new user and return a bearer token
POST/sessionsNoLog in an existing user and return a bearer token
GET/usersYesList all users in the shared chat
GET/messages?limit=100YesList recent messages, oldest to newest
POST/messagesYesCreate a message over HTTP as the authenticated user

Create user

POST https://f2xchat.roybot.se/users
Content-Type: application/json

{
  "name": "Ada",
  "password": "correct horse battery staple"
}

Response 201

{
  "user": {
    "id": "user_123",
    "name": "Ada",
    "createdAt": "2026-03-12T14:00:00.000Z"
  },
  "token": "session_token_here"
}

Log in

POST https://f2xchat.roybot.se/sessions
Content-Type: application/json

{
  "name": "Ada",
  "password": "correct horse battery staple"
}

Response 201

{
  "user": {
    "id": "user_123",
    "name": "Ada",
    "createdAt": "2026-03-12T14:00:00.000Z"
  },
  "token": "session_token_here"
}

List users

GET https://f2xchat.roybot.se/users
Authorization: Bearer <token>

Response 200

{
  "users": [
    {
      "id": "user_123",
      "name": "Ada",
      "createdAt": "2026-03-12T14:00:00.000Z"
    }
  ]
}

List messages

GET https://f2xchat.roybot.se/messages?limit=100
Authorization: Bearer <token>

Response 200

{
  "messages": [
    {
      "id": "msg_123",
      "userId": "user_123",
      "userName": "Ada",
      "content": "hello workshop",
      "createdAt": "2026-03-12T14:01:00.000Z"
    }
  ]
}

Create message over HTTP

POST https://f2xchat.roybot.se/messages
Authorization: Bearer <token>
Content-Type: application/json

{
  "content": "hello over HTTP"
}

Response 201

{
  "id": "msg_124",
  "userId": "user_123",
  "userName": "Ada",
  "content": "this arrived in real time",
  "createdAt": "2026-03-12T14:02:00.000Z"
}

WebSocket connection

GET wss://f2xchat.roybot.se/ws?token=<token>

Client → server WebSocket message

{
  "type": "message.create",
  "payload": {
    "content": "hello over WebSocket"
  }
}

Server → client: hello

{
  "type": "hello",
  "payload": {
    "authenticatedUser": {
      "id": "user_123",
      "name": "Ada",
      "createdAt": "2026-03-12T14:00:00.000Z"
    },
    "users": [
      {
        "id": "user_123",
        "name": "Ada",
        "createdAt": "2026-03-12T14:00:00.000Z"
      }
    ],
    "messages": [
      {
        "id": "msg_123",
        "userId": "user_123",
        "userName": "Ada",
        "content": "hello workshop",
        "createdAt": "2026-03-12T14:01:00.000Z"
      }
    ]
  }
}

Server → client: user.created

{
  "type": "user.created",
  "payload": {
    "id": "user_124",
    "name": "Linus",
    "createdAt": "2026-03-12T14:03:00.000Z"
  }
}

Server → client: message.created

{
  "type": "message.created",
  "payload": {
    "id": "msg_124",
    "userId": "user_123",
    "userName": "Ada",
    "content": "this arrived in real time",
    "createdAt": "2026-03-12T14:02:00.000Z"
  }
}

Server → client: error

{
  "type": "error",
  "payload": {
    "message": "content is required"
  }
}

Browser playground

No authenticated user yet.

Waiting for action...

Current users (0)

Recent messages (0)