DO websocket with DOSQLite
We're building off of the DO chat sample.
We're trying to create a single websocket per user so they can switch between their chats. BUT currently, if a user connects with their chatid for the chatroomObject, that wont allow the user to swap between their chats while still being connected via websocket because the entire DO object is based off of the chatid.
Would it be dumb to use <app-name> as the chatid for all users and store ALL chat messages in one table and query that via DOSQLite?
We're trying to create a single websocket per user so they can switch between their chats. BUT currently, if a user connects with their chatid for the chatroomObject, that wont allow the user to swap between their chats while still being connected via websocket because the entire DO object is based off of the chatid.
Would it be dumb to use <app-name> as the chatid for all users and store ALL chat messages in one table and query that via DOSQLite?
this.sql.exec('CREATE TABLE IF NOT EXISTS chat_message(
_id INTEGER PRIMARY KEY AUTOINCREMENT,
userId INTEGER NOT NULL,
message TEXT NOT NULL,
createdAt DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updatedAt DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
isDeleted BOOLEAN NOT NULL DEFAULT 0,
chatId INTEGER NOT NULL
);')