iink SDK Web

Answered

websocket event handler?

Is there a way to register an event listener to handle incoming WebSocket data?

I would like to provide specific handling for the user when the session is terminated.



Best Answer

Dear Woongki Kim,

Thank you for your question.

If you are using iinkTS with TEXT or MATH and Websocket, there is already a mechanism in the manageErrorMessage method of the https://github.com/MyScript/iinkTS/blob/master/src/recognizer/WSRecognizer.ts object that detects the session disconnection and transmits an internal error event with the InternalEvent object.
You can then add an error listener with the addErrorListener of the InternalEvent object, to listen to these internal error event.
You can refer to the Editor object that already implements such a listener  to detect session terminations and display the error messages with its showError method: https://github.com/MyScript/iinkTS/blob/master/src/Editor.ts#L381


Best regards,


Gwenaëlle




Answer

Dear Woongki Kim,

Thank you for your question.

If you are using iinkTS with TEXT or MATH and Websocket, there is already a mechanism in the manageErrorMessage method of the https://github.com/MyScript/iinkTS/blob/master/src/recognizer/WSRecognizer.ts object that detects the session disconnection and transmits an internal error event with the InternalEvent object.
You can then add an error listener with the addErrorListener of the InternalEvent object, to listen to these internal error event.
You can refer to the Editor object that already implements such a listener  to detect session terminations and display the error messages with its showError method: https://github.com/MyScript/iinkTS/blob/master/src/Editor.ts#L381


Best regards,


Gwenaëlle




1 person likes this

thank you!