Running WebSocket Client in Rscript [No Connection]
jfontestad opened this issue · 3 comments
Hi,
First off, thank you for this gem. I can finally connect to a feed via websocket using R. :)
A quick synopsis of what I have my script doing. It is pulling a in a feed and the results are being stored in a database.
The issue is, that although I was able to get this up and running and working as intended when I have RStudio open, the problem resides in when I run the script using Rscript from the terminal; the websocket connection does not appear to be established.
I have tried many different things, but still no luck.
The error I am getting is :
[2018-11-01 07:52:50] [info] Error getting remote endpoint: asio.system:9 (Bad file descriptor)
Any guidance / help would greatly be appreciated.
Kind Regards
Can you provide a reproducible example?
@jfontestad that message looks like an [info]
level message from the underlying websocketpp library, and this issue on websocketpp leads me to think that it might be innocuous.
Is your application actually non-functional when running via Rscript, or did you just see that message but your application still works properly?
The application did run in RStudio as intended.
When I would attempt to run the same code with 'RScript websocket.r' I was getting the error as posted above.
However, now I have managed to find a 'fix'/'workaround' to where it is working, where I have the basic sample script with all ws$* defined, but Websocket$new configured with autoconnect=F and when establishing the ws$connect, i have 'new_ws <- future::future(ws$connect())'; then in a while(TRUE) loop, have 'later::run_now(0.01)' (which I found looking at solutions for other issues). These changes have allowed my script (websocket client) to run without error from a terminal window.