>
> Hello everyone,
> I'm stuck, I've tried two ways and none of them work for me.
>
*1.- POST / service*
$(function() {
$("#btres").click(function() {
$.post(
"https://sagecell.sagemath.org/service",
"code:factorial(10)",
function(d, st, xhr) {
alert(xhr.responseText);
},
"json"
);
})
})
The alert shows:
{"execute_reply": {"status": "ok", "execution_count": 0,
"user_expressions": {}, "payload": []}, "success": true}
As you have noticed: status is ok and success is true but user_expressions
is empty
I've also tried with "code = factorial (10)", with and without {}
*2.- Websocket*
$(function() {
$("#btres").click(function() {
$.post(
"https://sagecell.sagemath.org/kernel",
wsconnect,
"json"
);
})
})
var shlws, iopws;
function wsconnect(data, st, xhr) {
var wsshell = data.ws_url + "kernel/" + data.id + "/shell";
var wsiopub = data.ws_url + "kernel/" + data.id + "/iopub";
alert(wsshell);
alert(wsiopub);
try {
shlws = new WebSocket(wsshell);
iopws = new WebSocket(wsiopub);
} catch(e) {
alert(e);
}
}
The alerts show:
wss://sagecell.sagemath.org/kernel/0bd6d4cc-8d9f-4ee3-bf00-5d2d3ec57cc2/shell
wss://sagecell.sagemath.org/kernel/0bd6d4cc-8d9f-4ee3-bf00-5d2d3ec57cc2/iopub
Two exceptions are caught:
WebSocket connection to
'wss://sagecell.sagemath.org/kernel/0bd6d4cc-8d9f-4ee3-bf00-5d2d3ec57cc2/shell'
failed: Error during WebSocket handshake: Unexpected response code: 404
WebSocket connection to
'wss://sagecell.sagemath.org/kernel/0bd6d4cc-8d9f-4ee3-bf00-5d2d3ec57cc2/iopub'
failed: Error during WebSocket handshake: Unexpected response code: 404
I'm really lost. What am I doing wrong?
Any help would be appreciated.
Jorge
--
You received this message because you are subscribed to the Google Groups
"sage-cell" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sage-cell/58688f6e-bad9-4717-b94a-eaa1fadfa291%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.