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 allows you to interact with your ink like you would with any other digital content. In addition, it 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.
When using WebSockets protocol, we further distinguish two different modes that we call offscreen and onscreen:
With onscreen mode, the interactivity principle relies on svg patches rendering updates sent by the server in order to take advantage of iink SDK Web interactive features via Math and Text WebSockets APIs.
With offscreen mode, your client application drives the content model update by sending ink strokes to the server, but all rendering is done on the client side. This mode maintains the incremental recognition principle and uses gesture notifications. As all rendering is done on the client side, this mode allows the implementation of features such as lasso selection, ink copy/paste, and easier integration of custom rendering. In addition, this mode relies on a “Raw Content” content part, where you can write and draw freely on a wide canvas and interact with the content without explicit segmentation into text, math, shapes or drawing.
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 users edit and interact with what they write or import. WebSockets are also ideal if you are looking for an immediate feedback. REST API addresses the use case of recognition of an already set of strokes.
Every time your users move the pen up, the coordinates of the strokes they 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 users have already written some content in another application and are 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.
Read the dedicated section in your account section.