add js functions to send/receive requests