iink SDK Web

Answered

Is it possible to send requests to the server based on conditions using WebSocket?

I have two modes one is drawn mode and the other is recognition mode. When the drawn mode is selected, it will just be drawn on the Iinkjs editor, not requested to the MyScript server.

 

if recognition mode has to select then tracks the strokes and has to hit the MyScript sever to recognition. it will work like IinkJs Default behavior.

 

How can I do that? how can I control the client-side server request called IinkJs editor?


Best Answer

Dear Biplob,

thank you for contacting us and your question.

First, I recommend you refer to our advanced-usage page: https://developer.myscript.com/docs/interactive-ink/latest/web/iinkjs/advanced-usage/

Basically, the inkJS has several features:
-a Grabber, that is in charge of catching the pointerEvents
-a stroker, that draws the strokes
-the recognizer, the renderer...

From this, you understand you would have to call the recognizer on demand. In that case, would you use the REST or webSocket API?

If using the webSocket API, the latter has not been designed for such purpose, and you shall tweak the iinkJS: https://github.com/MyScript/iinkJS

If using the REST API, you shall trigger the exportContent on demand:

...
iink.register(editorElement, {
triggers: {
exportContent: 'DEMAND'
},
...

You can then call the recognition by your yourself, proceeding as in the rest_no_ui sample we provide: https://github.com/MyScript/iinkJS/blob/master/examples/v4/rest_no_ui.html

Best regards,

Olivier

1 Comment

Answer

Dear Biplob,

thank you for contacting us and your question.

First, I recommend you refer to our advanced-usage page: https://developer.myscript.com/docs/interactive-ink/latest/web/iinkjs/advanced-usage/

Basically, the inkJS has several features:
-a Grabber, that is in charge of catching the pointerEvents
-a stroker, that draws the strokes
-the recognizer, the renderer...

From this, you understand you would have to call the recognizer on demand. In that case, would you use the REST or webSocket API?

If using the webSocket API, the latter has not been designed for such purpose, and you shall tweak the iinkJS: https://github.com/MyScript/iinkJS

If using the REST API, you shall trigger the exportContent on demand:

...
iink.register(editorElement, {
triggers: {
exportContent: 'DEMAND'
},
...

You can then call the recognition by your yourself, proceeding as in the rest_no_ui sample we provide: https://github.com/MyScript/iinkJS/blob/master/examples/v4/rest_no_ui.html

Best regards,

Olivier


1 person likes this