iink SDK Web

Answered

websocket return code : 1006 reason : "abnormal closure"

Hi,

when i use MyScriptJS on wechat mini program, websocket can connect but disconnected after a while, it report error [code : 1006 reason : "abnormal closure"]

onClose:2493

LoggerConfig.js:16 close websocket callback:{"code":1006,"reason":"abnormal closure","type":"close"}


Best Answer

Dear Ling Long,


thank you for contacting us.


The reason of this error is likely because the webSocket has been closed. Indeed, after 3 minutes without exchanges, the channel is closed (see the "What counts as a request?" part of the pricing documentation: https://developer.myscript.com/pricing).


In order to prevent the closing, you can use a ping-pong mechanism: the https://developer.myscript.com/docs/interactive-ink/1.3/web/websockets/messages/#ping-pong


Best regards,


Olivier




what does [code : 1006 reason : "abnormal closure"] mean, what can do to fix it.

Answer

Dear Ling Long,


thank you for contacting us.


The reason of this error is likely because the webSocket has been closed. Indeed, after 3 minutes without exchanges, the channel is closed (see the "What counts as a request?" part of the pricing documentation: https://developer.myscript.com/pricing).


In order to prevent the closing, you can use a ping-pong mechanism: the https://developer.myscript.com/docs/interactive-ink/1.3/web/websockets/messages/#ping-pong


Best regards,


Olivier