json-rpc-example.k 258 B

12345678910111213141516171819202122232425
  1. \l json-rpc.k
  2. para:`0:
  3. para"register function sum: +/"
  4. sum:+/
  5. para""
  6. para"global id counter"
  7. id:0
  8. para""
  9. para"client asks"
  10. ask:{req["sum";id+:1;2 3 4]}
  11. para""
  12. para"create message"
  13. m:`j@r:!/+ask[]
  14. para@m
  15. para""
  16. r"id"
  17. para"answer:"
  18. m:`j@!/+recv@m
  19. para@m