Math

Answered

How to avoid timeout?

I'm using MyScript math like bellow.

 MyScript.register(editorElement, {

     recognitionParams: {

          type: 'MATH',

          protocol: 'WEBSOCKET',

          apiVersion: 'V4',

          server: {

            scheme: 'https',

            host: 'webdemoapi.myscript.com',

            applicationKey: 'XXXX',

            hmacKey: 'XXXX',

          },

          v4: {

            math: {

              mimeTypes: ['application/x-latex']

            }

          }

        }

      });

Without any gesture for 3min, timeout message [MyScript recognition server is not reachable.Please reload once you are connected.] will be appear.

How can I avoid this message or extend timeout? Or, how can I avoid timeout by any method?



Best Answer

Dear Yoshihiro Hanawa,


Thank you for contacting and your question.


Indeed, when no request is done in a webSocket for 3 minutes, this webSocket is closed. The reason is to avoid having "dead webSockets".


There is currently to way to change this delay. What you can do when this message occurs is to restore the iink session: https://developer.myscript.com/docs/interactive-ink/1.4/web/websockets/messages/#restore-an-iink-session


Best regards,


Olivier


Answer

Dear Yoshihiro Hanawa,


Thank you for contacting and your question.


Indeed, when no request is done in a webSocket for 3 minutes, this webSocket is closed. The reason is to avoid having "dead webSockets".


There is currently to way to change this delay. What you can do when this message occurs is to restore the iink session: https://developer.myscript.com/docs/interactive-ink/1.4/web/websockets/messages/#restore-an-iink-session


Best regards,


Olivier

Dear Oliver,

Thank you for your help.

Currently, I am using MyScript.register. Is this an old version? Should I use iink.register?

To restore the session, the iinkSessionid is needed. How can I this sessionid?

 

How can I get this sessionid?

Dear Yoshihiro Hanawa San,


Thanks you for the update. The


the iinkSessionId can be gotten when doing the Initialization with HMAC HandShake: https://developer.myscript.com/docs/interactive-ink/1.4/web/websockets/messages/#initialization-with-hmac-handshake



Best regards,


Olivier

Dear Oliver,

Thank you for your reply.

I understood iinkSessionId can be gotten with handshake.

But I am using very simple sample code, and I can not find handshake sample code.

How can I get any sample code?  Or how can I get iinkSessionId by any addEventlistener?

Dear Yoshihiro Hanawa San,


The easier is that you use our iinkJS: https://myscript.github.io/iinkJS/examples/


And the source is available on gitHub: https://github.com/MyScript/iinkJS


Best regards,


Olivier