nrepl

https://github.com/nrepl/nrepl || https://nrepl.org
Jon 2019-03-03T13:33:40.000900Z

coffee> client.lsSessions (err, result) -> console.log result
{ id: 'D554DFD6-8014-40D9-A298-F33F41AD6DF5',
  op: 'ls-sessions' }
coffee> [ { id: 'D554DFD6-8014-40D9-A298-F33F41AD6DF5',
    session: 'c915cda9-ab75-4445-95a0-66bf7027e661',
    sessions: [],
    status: [ 'done' ] } ]

undefined
coffee> client.eval "(println (range 100))", 'cljs.user', 'c915cda9-ab75-4445-95a0-66bf7027e661', (err, result) -> console.log err, result
send chunk: { op: 'eval',
  code: '(println (range 100))',
  ns: 'cljs.user',
  session: 'c915cda9-ab75-4445-95a0-66bf7027e661',
  id: undefined,
  eval: undefined }
{ id: 'B4E0DE55-E082-41C2-9AC7-62692CAEAF03',
  op: 'eval',
  code: '(println (range 100))',
  ns: 'cljs.user',
  session: 'c915cda9-ab75-4445-95a0-66bf7027e661' }
coffee> null [ { id: 'B4E0DE55-E082-41C2-9AC7-62692CAEAF03',
    session: 'c915cda9-ab75-4445-95a0-66bf7027e661',
    status: [ 'done', 'unknown-session', 'error' ] } ]

Jon 2019-03-03T13:33:59.001400Z

I got some trouble understanding "session" in nREPL.

Jon 2019-03-03T13:34:40.002100Z

I copied session value from last response, as my session argument

Jon 2019-03-03T13:34:59.002600Z

however it kept telling me "unknown-session"

dominicm 2019-03-03T13:44:22.003100Z

If you want to use a session, you need to create one first

Jon 2019-03-03T13:53:46.003400Z

clone one..

Jon 2019-03-03T13:53:47.003500Z

got

Jon 2019-03-03T13:54:16.004300Z

=>> coffee client.coffee
send chunk: { op: 'eval',
  code: '(println a)',
  ns: 'user',
  session: '6d931230-e646-4ba8-aef5-85127d3e9ff4',
  id: undefined,
  eval: undefined }
eval null [ { err:
     'SyntaxError: Unexpected token .\n    at <http://192.168.1.196:7000//cljs-runtime/shadow.cljs.devtools.client.browser.js:823:13\n>    at Object.shadow$cljs$devtools$client$env$repl_call [as repl_call] (<http://192.168.1.196:7000//cljs-runtime/shadow.cljs.devtools.client.env.js:141:108>)\n    at Object.shadow$cljs$devtools$client$browser$repl_invoke [as repl_invoke] (<http://192.168.1.196:7000//cljs-runtime/shadow.cljs.devtools.client.browser.js:821:46>)\n    at shadow$cljs$devtools$client$browser$handle_message (<http://192.168.1.196:7000//cljs-runtime/shadow.cljs.devtools.client.browser.js:901:44>)\n    at Object.shadow$cljs$devtools$client$env$process_ws_msg [as process_ws_msg] (<http://192.168.1.196:7000//cljs-runtime/shadow.cljs.devtools.client.env.js:261:102>)\n    at WebSocket.&lt;anonymous&gt; (<http://192.168.1.196:7000//cljs-runtime/shadow.cljs.devtools.client.browser.js:1000:40>)',
    id: '177DD78E-6ED6-4105-BA7A-05BDDE95F7C0',
    session: '6d931230-e646-4ba8-aef5-85127d3e9ff4' },
  { id: '177DD78E-6ED6-4105-BA7A-05BDDE95F7C0',
    session: '6d931230-e646-4ba8-aef5-85127d3e9ff4',
    status: [ 'done' ] } ]

Jon 2019-03-03T13:54:20.004500Z

how about this error?

Jon 2019-03-03T13:54:36.004900Z

I don't know why it has syntax errors...

Jon 2019-03-03T13:56:46.005400Z

....probably caused by shadow-cljs.. will look into that. thx.