Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
165 views
in Technique[技术] by (71.8m points)

r - How call the code from the beginning if the error occurred?

I have connected to the websocket server

source(paste0(path, "source.R"))
ws$connect

In the source path, there is following information

ws <- WebSocket$new("wss://XXXXX/WebSocket", autoConnect = FALSE)
ws$onError(function(event) {
  cat("Client failed to connect: ", event$message, "
")
  
})


ws$onOpen(function(event) {
con$send("hello")
})

How can I make that if the error occurred between time 09.00 and 18.00, then do ws$close and run again:

source(paste0(path, "source.R"))
ws$connect

As a result, it will rerun every time there is an error inside this period of time. If outside then only run ws$close

question from:https://stackoverflow.com/questions/65846219/how-call-the-code-from-the-beginning-if-the-error-occurred

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...