WebSocket service

15 views
Skip to first unread message

Jeremy Sylvestre

unread,
Jan 15, 2026, 3:21:12 PMJan 15
to sage-cell
This is a follow up to my question about /service that was forwarded to this group from sage-support.

Is the websocket service also restricted? I've been able to successfully connect, send a simple code request, and receive a calculation result in the following two ways:

1) Using the python script

2) Using a command-line websocket client

But when I try using some basic JS, I get a 403 response.

// JS code
const response = await fetch('https://sagecell.sagemath.org/kernel', {
  method: 'POST',
  body: '{"accepted_tos": "true:}',
  headers: { 'Content-Type': 'application/json' }
});
const data = await response.json();
const full_url = `${data.ws_url}kernel/${data.id}/channels`;
const socket = new WebSocket(full_url);
// ^^^^ this line fails with 403 response from server

Any guidance would be appreciated.

Andrey Novoseltsev

unread,
Jan 15, 2026, 4:32:28 PMJan 15
to sage-cell
The intention of public servers is to provide an easy way to embed SageMathCells into web-pages for interactive purposes.

There is a potential that some other experimental ways of using the servers are still working, but no guarantee that it will be the case and no intentions to expand it.

If you want, you can run your own server and configure it with whatever restrictions you want. Added benefit - you decide which packages to install.

Best regards,
Andrey

Jeremy Sylvestre

unread,
Jan 15, 2026, 5:47:35 PMJan 15
to sage-cell
Makes sense, thanks for your reply.

My goal wasn't to abuse the "free" compute service of sagecell.sagemath.org. I had (yet another) interactive matrix row-operation-calculator tool for my students, but didn't want to burden them with learning sage commands or python. Previously I used /service to do the calculations. I'll look for another way, or just drop it and find an existing online tool to point my students to.

Regards,
Jeremy S

Andrey Novoseltsev

unread,
Jan 15, 2026, 6:23:19 PMJan 15
to sage-cell
I definitely didn't mean to say that you personally would abuse the resources, but the problem is that if the site is easy to use from scripts, then it is just a matter of time for some abusers to appear. Some are not even intentional, but send as many requests to the server as they can and then the service becomes unavailable for everyone. Limiting the rate of requests is a difficult problem to solve since you don't know how computationally heavy a given request is in advance.
Reply all
Reply to author
Forward
0 new messages