AutoJs6 icon indicating copy to clipboard operation
AutoJs6 copied to clipboard

Can not use Timer(setTimeout/setInterval/...) in websocket

Open anhnhoktvn opened this issue 2 years ago • 2 comments

let ws = web.newWebSocket('wss://echo.websocket.events')

setImmediate(() => {
  console.log('This is fine')
})

ws.on('open', (res, ws) => {
  setImmediate(() => {
    console.log('This is error<-----------')
  })
  
})
setTimeout(() => {
  ws.close(1000, 'Closed by user')
}, 8e3)

Error log:

 Wrapped java.lang.NullPointerException: Attempt to invoke virtual method 'int org.autojs.autojs.core.looper.Timer.setImmediate(java.lang.Object, java.lang.Object[])' on a null object reference ($remote/main2.js#8)
Wrapped java.lang.NullPointerException: Attempt to invoke virtual method 'int org.autojs.autojs.core.looper.Timer.setImmediate(java.lang.Object, java.lang.Object[])' on a null object reference

anhnhoktvn avatar Jun 17 '23 00:06 anhnhoktvn

Thank you for the feedback, but I can't reproduce the bug reported above.

Have you tried out the latest version of both AutoJs6 and its VSCode extension?

SuperMonster003 avatar Jul 25 '23 07:07 SuperMonster003

I've tried on the latest version v6.3.3, still got that errror

3 4

anhnhoktvn avatar Aug 27 '23 09:08 anhnhoktvn