Chat & OneSignal push test

Course-scoped 1:1 chat: students ↔ instructors for approved enrollments only. Plus class group chat: instructor + all students in a class group, shared thread. Open several browser profiles (one instructor + one or more students) to test all of it. Swagger

Setup

Serve this page from the same origin as the API so /OneSignalSDKWorker.js works (e.g. http://localhost:3000/chat-push-test.html). Student needs status: approved enrollment; instructor must be course.instructorId. Seed: npm run seed:all — student student@academy.local / instructor from school admin.

1. Login

2. OneSignal push

Uses MongoDB user _id as external_id. Requires OneSignal env on API.

Live updates (Socket.IO) offline

Connects automatically after login with the access token as auth.token. While connected, polling is switched off: new messages, deletes, read receipts and typing arrive live, and text messages are sent over the socket (attachments still use REST).

3. Chat contacts

4. Conversations

5. Messages

6. Class groups (instructor)

Instructor only. Create a group of students who share a course, then open it below to test the shared group chat. Renaming, adding/removing students, and delete are instructor-only too — use Swagger for those.

7. Class group chat

Log