Hi,
I'm trying to implement an nREPL client (browser based, in javascript) using the drawbridge transport. On the whole it's working well, but I'm having a problem with session IDs that's got me stumped. I think maybe the problem is that I don't understand really what the session IDs are for, but the apparent problem is as follows ...
I POST a request to the drawbridge endpoint to evaluate some code. I don't have a session ID test (this is the first communication I send to the server), so I don't include a session key in my message. Message JSON payload:
{"op":"eval","code":"(+ 1 1)","id":"1097c65d-2aaa-456c-8739-8f4fc68e7be6"}
I poll the REPL endpoint and I get some sensible looking replies back:
{"ns":"user","value":"2","session":"0280dd9d-5cf5-47f5-a1ed-4709383d5a01","id":"1097c65d-2aaa-456c-8739-8f4fc68e7be6"}
{"status":["done"],"session":"0280dd9d-5cf5-47f5-a1ed-4709383d5a01","id":"1097c65d-2aaa-456c-8739-8f4fc68e7be6"}
From these I take the session parameter and store it to use with my subsequent requests. If I try and issue another evaluation request, using the session ID that I captured:
{"op":"eval","code":"(+ 4 5)","id":"39976a0f-f88f-46fa-90da-75318262fc1b","session":"0280dd9d-5cf5-47f5-a1ed-4709383d5a01"}
Then I get an error back:
{"status":["unknown-session","error"],"session":"0280dd9d-5cf5-47f5-a1ed-4709383d5a01","id":"39976a0f-f88f-46fa-90da-75318262fc1b"}
Anybody able to point me in the right direction here?
Many thanks in advance,
Jony