summaryrefslogtreecommitdiff
path: root/wsm.go (follow)
Commit message (Collapse)AuthorAgeFilesLines
* {ws,wsm}.go: Handle context cancellationsRunxi Yu13 days1-0/+20
|
* {main,ws,wsm}.go: Attempt to cancel old sessionsRunxi Yu13 days1-15/+15
| | | | | | | | | | | | | | | | | | | When beginning to handle a WebSocket connection, we shall create a new context, with the request context as its parent. We use the new context for everything from now on, except for reporting error messages, which is handled by creating a reportError function in a closure in makeReportError and passing it along to command-handling functions. Note that if one user attempts to rapidly launch WebSocket connections, there might still be a race condition where the old connection hasn't been completely established yet (i.e. an entry hasn't been added to cancelPool) and the new connection isn't able to cancel the old connection. I'm a bit tired to think of a solution now but it could probably be solved by moving the cancellation registration and cancelling sooner during the initial handshake. Note that more parts of the event loop needs to select from ctx.Done (from newCtx) for this to work reliably.
* wsm.go, main.js: Use M for number, N for deselectRunxi Yu2024-10-021-3/+3
| | | | | | | Previously both commands used N, and deselection wasn't really implemented on the JavaScript side. It worked and didn't throw an exception but it's technically wrong and the user could see an empty number field for a split second.
* {auth,db,wsm}.go: Make 23505 (uniqueness violation) a constantRunxi Yu2024-10-011-1/+1
|
* wsm.go, main.js: Display the user's selected courses on first runv0.1.0Runxi Yu2024-10-011-2/+18
| | | | | It's done in the WebSocket routines rather than in the template maker because it's relatively easier to write the logic this way.
* {ws,wsm}.go: Split message handlers into their own functionsRunxi Yu2024-10-011-0/+177