Choosing between REST or WebSockets
This section describes the different types of server APIs and aims at helping you choose the one you need.
REST over HTTP is an unconnected protocol designed to deliver web pages. Each HTTP/REST request implies a new connection that you have to scramble. Creating and scrambling new requests take time. Every time you make a request you have to provide context and configuration information. REST APIs are very easy to integrate and can settle for low quality networks conditions.
WebSockets is a connected mode, allowing you to create a unique scrambled connection, where requests are continuously sent and received. This protocol can be time-saving but requires to be supported by your browser (or programming language used on the client side), as well as a high-speed and very stable network condition.
Recognition API could be used in several ways. Depending on what your user writes, you can choose the API you need. WebSockets APIs address the use case where the user edits what he writes or imports. WebSockets are also ideal if you are looking for an immediate feedback. REST address the use case of recognition of an already set of strokes.
Every time your user moves the pen up, the coordinate of the strokes he just drew are sent to the server which immediately recognize the content. Gestures are detected immediately. The user input could be updated immediately. WebSocket is the mode you need.
If your user has already written some content in another application and is willing to import it into MyScript world and then manipulate it, the WebSockets API offers a importStrokes API to do so.
If you have already collected the user strokes and want to recognize the digital content, REST is the required mode. At the moment, this mode is only available in V3 mode.
Read the dedicated section in your account section.